diff --git a/src/include.new/FlexLexer.h b/src/include.new/FlexLexer.h new file mode 100644 index 0000000..30b1a3b --- /dev/null +++ b/src/include.new/FlexLexer.h @@ -0,0 +1,186 @@ +// $Header$ +// $FreeBSD: src/usr.bin/lex/FlexLexer.h,v 1.4 2004/03/11 10:43:35 josef Exp $ + +// FlexLexer.h -- define interfaces for lexical analyzer classes generated +// by flex + +// Copyright (c) 1993 The Regents of the University of California. +// All rights reserved. +// +// This code is derived from software contributed to Berkeley by +// Kent Williams and Tom Epperly. +// +// Redistribution and use in source and binary forms are permitted provided +// that: (1) source distributions retain this entire copyright notice and +// comment, and (2) distributions including binaries display the following +// acknowledgement: ``This product includes software developed by the +// University of California, Berkeley and its contributors'' in the +// documentation or other materials provided with the distribution and in +// all advertising materials mentioning features or use of this software. +// Neither the name of the University nor the names of its contributors may +// be used to endorse or promote products derived from this software without +// specific prior written permission. +// THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED +// WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF +// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + +// This file defines FlexLexer, an abstract class which specifies the +// external interface provided to flex C++ lexer objects, and yyFlexLexer, +// which defines a particular lexer class. +// +// If you want to create multiple lexer classes, you use the -P flag +// to rename each yyFlexLexer to some other xxFlexLexer. You then +// include in your other sources once per lexer class: +// +// #undef yyFlexLexer +// #define yyFlexLexer xxFlexLexer +// #include +// +// #undef yyFlexLexer +// #define yyFlexLexer zzFlexLexer +// #include +// ... + +#ifndef __FLEX_LEXER_H +// Never included before - need to define base class. +#define __FLEX_LEXER_H +#include + +extern "C++" { + +struct yy_buffer_state; +typedef int yy_state_type; + +class FlexLexer { +public: + virtual ~FlexLexer() { } + + const char* YYText() { return yytext; } + int YYLeng() { return yyleng; } + + virtual void + yy_switch_to_buffer( struct yy_buffer_state* new_buffer ) = 0; + virtual struct yy_buffer_state* + yy_create_buffer( std::istream* s, int size ) = 0; + virtual void yy_delete_buffer( struct yy_buffer_state* b ) = 0; + virtual void yyrestart( std::istream* s ) = 0; + + virtual int yylex() = 0; + + // Call yylex with new input/output sources. + int yylex( std::istream* new_in, std::ostream* new_out = 0 ) + { + switch_streams( new_in, new_out ); + return yylex(); + } + + // Switch to new input/output streams. A nil stream pointer + // indicates "keep the current one". + virtual void switch_streams( std::istream* new_in = 0, + std::ostream* new_out = 0 ) = 0; + + int lineno() const { return yylineno; } + + int debug() const { return yy_flex_debug; } + void set_debug( int flag ) { yy_flex_debug = flag; } + +protected: + char* yytext; + int yyleng; + int yylineno; // only maintained if you use %option yylineno + int yy_flex_debug; // only has effect with -d or "%option debug" +}; + +} +#endif + +#if defined(yyFlexLexer) || ! defined(yyFlexLexerOnce) +// Either this is the first time through (yyFlexLexerOnce not defined), +// or this is a repeated include to define a different flavor of +// yyFlexLexer, as discussed in the flex man page. +#define yyFlexLexerOnce + +class yyFlexLexer : public FlexLexer { +public: + // arg_yyin and arg_yyout default to the cin and cout, but we + // only make that assignment when initializing in yylex(). + yyFlexLexer( std::istream* arg_yyin = 0, std::ostream* arg_yyout = 0 ); + + virtual ~yyFlexLexer(); + + void yy_switch_to_buffer( struct yy_buffer_state* new_buffer ); + struct yy_buffer_state* yy_create_buffer( std::istream* s, int size ); + void yy_delete_buffer( struct yy_buffer_state* b ); + void yyrestart( std::istream* s ); + + virtual int yylex(); + virtual void switch_streams( std::istream* new_in, std::ostream* new_out ); + +protected: + virtual int LexerInput( char* buf, int max_size ); + virtual void LexerOutput( const char* buf, int size ); + virtual void LexerError( const char* msg ); + + void yyunput( int c, char* buf_ptr ); + int yyinput(); + + void yy_load_buffer_state(); + void yy_init_buffer( struct yy_buffer_state* b, std::istream* s ); + void yy_flush_buffer( struct yy_buffer_state* b ); + + int yy_start_stack_ptr; + int yy_start_stack_depth; + int* yy_start_stack; + + void yy_push_state( int new_state ); + void yy_pop_state(); + int yy_top_state(); + + yy_state_type yy_get_previous_state(); + yy_state_type yy_try_NUL_trans( yy_state_type current_state ); + int yy_get_next_buffer(); + + std::istream* yyin; // input source for default LexerInput + std::ostream* yyout; // output sink for default LexerOutput + + struct yy_buffer_state* yy_current_buffer; + + // yy_hold_char holds the character lost when yytext is formed. + char yy_hold_char; + + // Number of characters read into yy_ch_buf. + int yy_n_chars; + + // Points to current character in buffer. + char* yy_c_buf_p; + + int yy_init; // whether we need to initialize + int yy_start; // start state number + + // Flag which is used to allow yywrap()'s to do buffer switches + // instead of setting up a fresh yyin. A bit of a hack ... + int yy_did_buffer_switch_on_eof; + + // The following are not always needed, but may be depending + // on use of certain flex features (like REJECT or yymore()). + + yy_state_type yy_last_accepting_state; + char* yy_last_accepting_cpos; + + yy_state_type* yy_state_buf; + yy_state_type* yy_state_ptr; + + char* yy_full_match; + int* yy_full_state; + int yy_full_lp; + + int yy_lp; + int yy_looking_for_trail_begin; + + int yy_more_flag; + int yy_more_len; + int yy_more_offset; + int yy_prev_more_offset; +}; + +#endif diff --git a/src/include.new/_ctype.h b/src/include.new/_ctype.h new file mode 100644 index 0000000..888f287 --- /dev/null +++ b/src/include.new/_ctype.h @@ -0,0 +1,157 @@ +/* + * Copyright (c) 1989, 1993 + * The Regents of the University of California. All rights reserved. + * (c) UNIX System Laboratories, Inc. + * All or some portions of this file are derived from material licensed + * to the University of California by American Telephone and Telegraph + * Co. or Unix System Laboratories, Inc. and are reproduced herein with + * the permission of UNIX System Laboratories, Inc. + * + * This code is derived from software contributed to Berkeley by + * Paul Borman at Krystal Technologies. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * From @(#)ctype.h 8.4 (Berkeley) 1/21/94 + * From FreeBSD: src/include/ctype.h,v 1.27 2004/06/23 07:11:39 tjr Exp + * $FreeBSD: src/include/_ctype.h,v 1.30 2004/08/21 07:00:40 tjr Exp $ + */ + +#ifndef __CTYPE_H_ +#define __CTYPE_H_ + +#include +#include + +#define _CTYPE_A 0x00000100L /* Alpha */ +#define _CTYPE_C 0x00000200L /* Control */ +#define _CTYPE_D 0x00000400L /* Digit */ +#define _CTYPE_G 0x00000800L /* Graph */ +#define _CTYPE_L 0x00001000L /* Lower */ +#define _CTYPE_P 0x00002000L /* Punct */ +#define _CTYPE_S 0x00004000L /* Space */ +#define _CTYPE_U 0x00008000L /* Upper */ +#define _CTYPE_X 0x00010000L /* X digit */ +#define _CTYPE_B 0x00020000L /* Blank */ +#define _CTYPE_R 0x00040000L /* Print */ +#define _CTYPE_I 0x00080000L /* Ideogram */ +#define _CTYPE_T 0x00100000L /* Special */ +#define _CTYPE_Q 0x00200000L /* Phonogram */ +#define _CTYPE_SW0 0x20000000L /* 0 width character */ +#define _CTYPE_SW1 0x40000000L /* 1 width character */ +#define _CTYPE_SW2 0x80000000L /* 2 width character */ +#define _CTYPE_SW3 0xc0000000L /* 3 width character */ +#define _CTYPE_SWM 0xe0000000L /* Mask for screen width data */ +#define _CTYPE_SWS 30 /* Bits to shift to get width */ + +/* See comments in about __ct_rune_t. */ +__BEGIN_DECLS +unsigned long ___runetype(__ct_rune_t) __pure; +__ct_rune_t ___tolower(__ct_rune_t) __pure; +__ct_rune_t ___toupper(__ct_rune_t) __pure; +__END_DECLS + +/* + * _EXTERNALIZE_CTYPE_INLINES_ is defined in locale/nomacros.c to tell us + * to generate code for extern versions of all our inline functions. + */ +#ifdef _EXTERNALIZE_CTYPE_INLINES_ +#define _USE_CTYPE_INLINE_ +#define static +#define __inline +#endif + +/* + * Use inline functions if we are allowed to and the compiler supports them. + */ +#if !defined(_DONT_USE_CTYPE_INLINE_) && \ + (defined(_USE_CTYPE_INLINE_) || defined(__GNUC__) || defined(__cplusplus)) + +#include + +static __inline int +__maskrune(__ct_rune_t _c, unsigned long _f) +{ + return ((_c < 0 || _c >= _CACHED_RUNES) ? ___runetype(_c) : + _CurrentRuneLocale->__runetype[_c]) & _f; +} + +static __inline int +__istype(__ct_rune_t _c, unsigned long _f) +{ + return (!!__maskrune(_c, _f)); +} + +static __inline int +__isctype(__ct_rune_t _c, unsigned long _f) +{ + return (_c < 0 || _c >= _CACHED_RUNES) ? 0 : + !!(_DefaultRuneLocale.__runetype[_c] & _f); +} + +static __inline __ct_rune_t +__toupper(__ct_rune_t _c) +{ + return (_c < 0 || _c >= _CACHED_RUNES) ? ___toupper(_c) : + _CurrentRuneLocale->__mapupper[_c]; +} + +static __inline __ct_rune_t +__tolower(__ct_rune_t _c) +{ + return (_c < 0 || _c >= _CACHED_RUNES) ? ___tolower(_c) : + _CurrentRuneLocale->__maplower[_c]; +} + +static __inline int +__wcwidth(__ct_rune_t _c) +{ + unsigned int _x; + + if (_c == 0) + return (0); + _x = (unsigned int)__maskrune(_c, _CTYPE_SWM|_CTYPE_R); + if ((_x & _CTYPE_SWM) != 0) + return ((_x & _CTYPE_SWM) >> _CTYPE_SWS); + return ((_x & _CTYPE_R) != 0 ? 1 : -1); +} + +#else /* not using inlines */ + +__BEGIN_DECLS +int __maskrune(__ct_rune_t, unsigned long); +int __istype(__ct_rune_t, unsigned long); +int __isctype(__ct_rune_t, unsigned long); +__ct_rune_t __toupper(__ct_rune_t); +__ct_rune_t __tolower(__ct_rune_t); +int __wcwidth(__ct_rune_t); +__END_DECLS +#endif /* using inlines */ + +#endif /* !__CTYPE_H_ */ diff --git a/src/include.new/_semaphore.h b/src/include.new/_semaphore.h new file mode 100644 index 0000000..b3f280e --- /dev/null +++ b/src/include.new/_semaphore.h @@ -0,0 +1,73 @@ +/*- + * Copyright (c) 2002 Alfred Perlstein + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD: src/sys/posix4/_semaphore.h,v 1.4 2005/01/07 02:29:19 imp Exp $ + */ +#ifndef __SEMAPHORE_H_ +#define __SEMAPHORE_H_ + +typedef intptr_t semid_t; +struct timespec; + +#ifndef _KERNEL + +#include + +/* + * Semaphore definitions. + */ +struct sem { +#define SEM_MAGIC ((u_int32_t) 0x09fa4012) + u_int32_t magic; + pthread_mutex_t lock; + pthread_cond_t gtzero; + u_int32_t count; + u_int32_t nwaiters; +#define SEM_USER (NULL) + semid_t semid; /* semaphore id if kernel (shared) semaphore */ + int syssem; /* 1 if kernel (shared) semaphore */ + LIST_ENTRY(sem) entry; + struct sem **backpointer; +}; + +__BEGIN_DECLS + +int ksem_close(semid_t id); +int ksem_post(semid_t id); +int ksem_wait(semid_t id); +int ksem_trywait(semid_t id); +int ksem_timedwait(semid_t id, struct timespec *abstime); +int ksem_init(semid_t *idp, unsigned int value); +int ksem_open(semid_t *idp, const char *name, int oflag, mode_t mode, + unsigned int value); +int ksem_unlink(const char *name); +int ksem_getvalue(semid_t id, int *val); +int ksem_destroy(semid_t id); + +__END_DECLS + +#endif /* !_KERNEL */ + +#endif /* __SEMAPHORE_H_ */ diff --git a/src/include.new/a.out.h b/src/include.new/a.out.h new file mode 100644 index 0000000..4053ce0 --- /dev/null +++ b/src/include.new/a.out.h @@ -0,0 +1,49 @@ +/*- + * Copyright (c) 1991, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)a.out.h 8.1 (Berkeley) 6/2/93 + * $FreeBSD: src/include/a.out.h,v 1.4 2004/06/22 17:05:36 obrien Exp $ + */ + +#ifndef _AOUT_H_ +#define _AOUT_H_ + +#include +#include +#include +#include +#include + +#define _AOUT_INCLUDE_ +#include + +#endif /* !_AOUT_H_ */ diff --git a/src/include.new/aio.h b/src/include.new/aio.h new file mode 100644 index 0000000..eed26bf --- /dev/null +++ b/src/include.new/aio.h @@ -0,0 +1,135 @@ +/*- + * Copyright (c) 1997 John S. Dyson. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. John S. Dyson's name may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * DISCLAIMER: This code isn't warranted to do anything useful. Anything + * bad that happens because of using this software isn't the responsibility + * of the author. This software is distributed AS-IS. + * + * $FreeBSD: src/sys/sys/aio.h,v 1.30 2005/01/07 02:29:23 imp Exp $ + */ + +#ifndef _SYS_AIO_H_ +#define _SYS_AIO_H_ + +#include +#include +#include + +/* + * Returned by aio_cancel: + */ +#define AIO_CANCELED 0x1 +#define AIO_NOTCANCELED 0x2 +#define AIO_ALLDONE 0x3 + +/* + * LIO opcodes + */ +#define LIO_NOP 0x0 +#define LIO_WRITE 0x1 +#define LIO_READ 0x2 + +/* + * LIO modes + */ +#define LIO_NOWAIT 0x0 +#define LIO_WAIT 0x1 + +/* + * Maximum number of allowed LIO operations + */ +#define AIO_LISTIO_MAX 16 + +/* + * Private members for aiocb -- don't access + * directly. + */ +struct __aiocb_private { + long status; + long error; + void *kernelinfo; +}; + +/* + * I/O control block + */ +typedef struct aiocb { + int aio_fildes; /* File descriptor */ + off_t aio_offset; /* File offset for I/O */ + volatile void *aio_buf; /* I/O buffer in process space */ + size_t aio_nbytes; /* Number of bytes for I/O */ + struct sigevent aio_sigevent; /* Signal to deliver */ + int aio_lio_opcode; /* LIO opcode */ + int aio_reqprio; /* Request priority -- ignored */ + struct __aiocb_private _aiocb_private; +} aiocb_t; + +#ifndef _KERNEL + +__BEGIN_DECLS +/* + * Asynchronously read from a file + */ +int aio_read(struct aiocb *); + +/* + * Asynchronously write to file + */ +int aio_write(struct aiocb *); + +/* + * List I/O Asynchronously/synchronously read/write to/from file + * "lio_mode" specifies whether or not the I/O is synchronous. + * "acb_list" is an array of "nacb_listent" I/O control blocks. + * when all I/Os are complete, the optional signal "sig" is sent. + */ +int lio_listio(int, struct aiocb * const [], int, struct sigevent *); + +/* + * Get completion status + * returns EINPROGRESS until I/O is complete. + * this routine does not block. + */ +int aio_error(const struct aiocb *); + +/* + * Finish up I/O, releasing I/O resources and returns the value + * that would have been associated with a synchronous I/O request. + * This routine must be called once and only once for each + * I/O control block who has had I/O associated with it. + */ +ssize_t aio_return(struct aiocb *); + +/* + * Cancel I/O + */ +int aio_cancel(int, struct aiocb *); + +/* + * Suspend until all specified I/O or timeout is complete. + */ +int aio_suspend(const struct aiocb * const[], int, const struct timespec *); + +int aio_waitcomplete(struct aiocb **, struct timespec *); + +__END_DECLS + +#else + +/* Forward declarations for prototypes below. */ +struct socket; +struct sockbuf; + +extern void (*aio_swake)(struct socket *, struct sockbuf *); + +#endif + +#endif diff --git a/src/include.new/alias.h b/src/include.new/alias.h new file mode 100644 index 0000000..0bf51b8 --- /dev/null +++ b/src/include.new/alias.h @@ -0,0 +1,277 @@ +/* lint -save -library Flexelint comment for external headers */ + +/*- + * Copyright (c) 2001 Charles Mott + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD: src/sys/netinet/libalias/alias.h,v 1.32 2005/05/05 21:53:17 glebius Exp $ + */ + +/*- + * Alias.h defines the outside world interfaces for the packet aliasing + * software. + * + * This software is placed into the public domain with no restrictions on its + * distribution. + */ + +#ifndef _ALIAS_H_ +#define _ALIAS_H_ + +#ifdef _KERNEL +/* + * The kernel version of libalias does not support these features. + */ +#define NO_FW_PUNCH +#define NO_LOGGING +#define NO_USE_SOCKETS +#endif + +/* + * The external interface to libalias, the packet aliasing engine. + * + * There are two sets of functions: + * + * PacketAlias*() the old API which doesn't take an instance pointer + * and therefore can only have one packet engine at a time. + * + * LibAlias*() the new API which takes as first argument a pointer to + * the instance of the packet aliasing engine. + * + * The functions otherwise correspond to each other one for one, except + * for the LibAliasUnaliasOut()/PacketUnaliasOut() function which were + * were misnamed in the old API. + */ + +/* + * The instance structure + */ +struct libalias; + +/* + * An anonymous structure, a pointer to which is returned from + * PacketAliasRedirectAddr(), PacketAliasRedirectPort() or + * PacketAliasRedirectProto(), passed to PacketAliasAddServer(), + * and freed by PacketAliasRedirectDelete(). + */ +struct alias_link; + + +/* OLD API */ + +/* Initialization and control functions. */ +void PacketAliasInit(void); +void PacketAliasSetAddress(struct in_addr _addr); +void PacketAliasSetFWBase(unsigned int _base, unsigned int _num); +void PacketAliasSetSkinnyPort(unsigned int _port); +unsigned int + PacketAliasSetMode(unsigned int _flags, unsigned int _mask); +void PacketAliasUninit(void); + +/* Packet Handling functions. */ +int PacketAliasIn(char *_ptr, int _maxpacketsize); +int PacketAliasOut(char *_ptr, int _maxpacketsize); +int PacketUnaliasOut(char *_ptr, int _maxpacketsize); + +/* Port and address redirection functions. */ + + +int +PacketAliasAddServer(struct alias_link *_lnk, + struct in_addr _addr, unsigned short _port); +struct alias_link * +PacketAliasRedirectAddr(struct in_addr _src_addr, + struct in_addr _alias_addr); +int PacketAliasRedirectDynamic(struct alias_link *_lnk); +void PacketAliasRedirectDelete(struct alias_link *_lnk); +struct alias_link * +PacketAliasRedirectPort(struct in_addr _src_addr, + unsigned short _src_port, struct in_addr _dst_addr, + unsigned short _dst_port, struct in_addr _alias_addr, + unsigned short _alias_port, unsigned char _proto); +struct alias_link * +PacketAliasRedirectProto(struct in_addr _src_addr, + struct in_addr _dst_addr, struct in_addr _alias_addr, + unsigned char _proto); + +/* Fragment Handling functions. */ +void PacketAliasFragmentIn(char *_ptr, char *_ptr_fragment); +char *PacketAliasGetFragment(char *_ptr); +int PacketAliasSaveFragment(char *_ptr); + +/* Miscellaneous functions. */ +int PacketAliasCheckNewLink(void); +unsigned short + PacketAliasInternetChecksum(unsigned short *_ptr, int _nbytes); +void PacketAliasSetTarget(struct in_addr _target_addr); + +/* Transparent proxying routines. */ +int PacketAliasProxyRule(const char *_cmd); + +/* NEW API */ + +/* Initialization and control functions. */ +struct libalias *LibAliasInit(struct libalias *); +void LibAliasSetAddress(struct libalias *, struct in_addr _addr); +void LibAliasSetFWBase(struct libalias *, unsigned int _base, unsigned int _num); +void LibAliasSetSkinnyPort(struct libalias *, unsigned int _port); +unsigned int + LibAliasSetMode(struct libalias *, unsigned int _flags, unsigned int _mask); +void LibAliasUninit(struct libalias *); + +/* Packet Handling functions. */ +int LibAliasIn (struct libalias *, char *_ptr, int _maxpacketsize); +int LibAliasOut(struct libalias *, char *_ptr, int _maxpacketsize); +int LibAliasOutTry(struct libalias *, char *_ptr, int _maxpacketsize, int _create); +int LibAliasUnaliasOut(struct libalias *, char *_ptr, int _maxpacketsize); + +/* Port and address redirection functions. */ + +int +LibAliasAddServer(struct libalias *, struct alias_link *_lnk, + struct in_addr _addr, unsigned short _port); +struct alias_link * +LibAliasRedirectAddr(struct libalias *, struct in_addr _src_addr, + struct in_addr _alias_addr); +int LibAliasRedirectDynamic(struct libalias *, struct alias_link *_lnk); +void LibAliasRedirectDelete(struct libalias *, struct alias_link *_lnk); +struct alias_link * +LibAliasRedirectPort(struct libalias *, struct in_addr _src_addr, + unsigned short _src_port, struct in_addr _dst_addr, + unsigned short _dst_port, struct in_addr _alias_addr, + unsigned short _alias_port, unsigned char _proto); +struct alias_link * +LibAliasRedirectProto(struct libalias *, struct in_addr _src_addr, + struct in_addr _dst_addr, struct in_addr _alias_addr, + unsigned char _proto); + +/* Fragment Handling functions. */ +void LibAliasFragmentIn(struct libalias *, char *_ptr, char *_ptr_fragment); +char *LibAliasGetFragment(struct libalias *, char *_ptr); +int LibAliasSaveFragment(struct libalias *, char *_ptr); + +/* Miscellaneous functions. */ +int LibAliasCheckNewLink(struct libalias *); +unsigned short + LibAliasInternetChecksum(struct libalias *, unsigned short *_ptr, int _nbytes); +void LibAliasSetTarget(struct libalias *, struct in_addr _target_addr); + +/* Transparent proxying routines. */ +int LibAliasProxyRule(struct libalias *, const char *_cmd); + + +/* + * Mode flags and other constants. + */ + + +/* Mode flags, set using PacketAliasSetMode() */ + +/* + * If PKT_ALIAS_LOG is set, a message will be printed to /var/log/alias.log + * every time a link is created or deleted. This is useful for debugging. + */ +#ifndef NO_LOGGING +#define PKT_ALIAS_LOG 0x01 +#endif + +/* + * If PKT_ALIAS_DENY_INCOMING is set, then incoming connections (e.g. to ftp, + * telnet or web servers will be prevented by the aliasing mechanism. + */ +#define PKT_ALIAS_DENY_INCOMING 0x02 + +/* + * If PKT_ALIAS_SAME_PORTS is set, packets will be attempted sent from the + * same port as they originated on. This allows e.g. rsh to work *99% of the + * time*, but _not_ 100% (it will be slightly flakey instead of not working + * at all). This mode bit is set by PacketAliasInit(), so it is a default + * mode of operation. + */ +#define PKT_ALIAS_SAME_PORTS 0x04 + +/* + * If PKT_ALIAS_USE_SOCKETS is set, then when partially specified links (e.g. + * destination port and/or address is zero), the packet aliasing engine will + * attempt to allocate a socket for the aliasing port it chooses. This will + * avoid interference with the host machine. Fully specified links do not + * require this. This bit is set after a call to PacketAliasInit(), so it is + * a default mode of operation. + */ +#ifndef NO_USE_SOCKETS +#define PKT_ALIAS_USE_SOCKETS 0x08 +#endif +/*- + * If PKT_ALIAS_UNREGISTERED_ONLY is set, then only packets with + * unregistered source addresses will be aliased. Private + * addresses are those in the following ranges: + * + * 10.0.0.0 -> 10.255.255.255 + * 172.16.0.0 -> 172.31.255.255 + * 192.168.0.0 -> 192.168.255.255 + */ +#define PKT_ALIAS_UNREGISTERED_ONLY 0x10 + +/* + * If PKT_ALIAS_RESET_ON_ADDR_CHANGE is set, then the table of dynamic + * aliasing links will be reset whenever PacketAliasSetAddress() changes the + * default aliasing address. If the default aliasing address is left + * unchanged by this function call, then the table of dynamic aliasing links + * will be left intact. This bit is set after a call to PacketAliasInit(). + */ +#define PKT_ALIAS_RESET_ON_ADDR_CHANGE 0x20 + +#ifndef NO_FW_PUNCH +/* + * If PKT_ALIAS_PUNCH_FW is set, active FTP and IRC DCC connections will + * create a 'hole' in the firewall to allow the transfers to work. The + * ipfw rule number that the hole is created with is controlled by + * PacketAliasSetFWBase(). The hole will be attached to that + * particular alias_link, so when the link goes away the hole is deleted. + */ +#define PKT_ALIAS_PUNCH_FW 0x100 +#endif + +/* + * If PKT_ALIAS_PROXY_ONLY is set, then NAT will be disabled and only + * transparent proxying is performed. + */ +#define PKT_ALIAS_PROXY_ONLY 0x40 + +/* + * If PKT_ALIAS_REVERSE is set, the actions of PacketAliasIn() and + * PacketAliasOut() are reversed. + */ +#define PKT_ALIAS_REVERSE 0x80 + +/* Function return codes. */ +#define PKT_ALIAS_ERROR -1 +#define PKT_ALIAS_OK 1 +#define PKT_ALIAS_IGNORED 2 +#define PKT_ALIAS_UNRESOLVED_FRAGMENT 3 +#define PKT_ALIAS_FOUND_HEADER_FRAGMENT 4 + +#endif /* !_ALIAS_H_ */ + +/* lint -restore */ diff --git a/src/include.new/ar.h b/src/include.new/ar.h new file mode 100644 index 0000000..e04874f --- /dev/null +++ b/src/include.new/ar.h @@ -0,0 +1,67 @@ +/*- + * Copyright (c) 1991, 1993 + * The Regents of the University of California. All rights reserved. + * (c) UNIX System Laboratories, Inc. + * All or some portions of this file are derived from material licensed + * to the University of California by American Telephone and Telegraph + * Co. or Unix System Laboratories, Inc. and are reproduced herein with + * the permission of UNIX System Laboratories, Inc. + * + * This code is derived from software contributed to Berkeley by + * Hugh Smith at The University of Guelph. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)ar.h 8.2 (Berkeley) 1/21/94 + */ + +#ifndef _AR_H_ +#define _AR_H_ + +/* Pre-4BSD archives had these magic numbers in them. */ +#define OARMAG1 0177555 +#define OARMAG2 0177545 + +#define ARMAG "!\n" /* ar "magic number" */ +#define SARMAG 8 /* strlen(ARMAG); */ + +#define AR_EFMT1 "#1/" /* extended format #1 */ + +struct ar_hdr { + char ar_name[16]; /* name */ + char ar_date[12]; /* modification time */ + char ar_uid[6]; /* user id */ + char ar_gid[6]; /* group id */ + char ar_mode[8]; /* octal file permissions */ + char ar_size[10]; /* size in bytes */ +#define ARFMAG "`\n" + char ar_fmag[2]; /* consistency check */ +}; + +#endif /* !_AR_H_ */ diff --git a/src/include.new/archive.h b/src/include.new/archive.h new file mode 100644 index 0000000..b354f97 --- /dev/null +++ b/src/include.new/archive.h @@ -0,0 +1,351 @@ +/*- + * Copyright (c) 2003-2004 Tim Kientzle + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer + * in this position and unchanged. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * $FreeBSD: src/lib/libarchive/archive.h.in,v 1.23.2.2 2006/09/05 05:23:51 kientzle Exp $ + */ + +#ifndef ARCHIVE_H_INCLUDED +#define ARCHIVE_H_INCLUDED + +/* + * This header file corresponds to: + * Library version 1.2.53 + * Shared library version 2 + */ + +#include /* Linux requires this for off_t */ +#include /* For int64_t */ +#include /* For ssize_t and size_t */ + +#ifdef __cplusplus +extern "C" { +#endif + + +/* + * If ARCHIVE_API_VERSION != archive_api_version(), then the library you + * were linked with is using an incompatible API. This is almost + * certainly a fatal problem. + * + * ARCHIVE_API_FEATURE is incremented with each significant feature + * addition, so you can test (at compile or run time) if a particular + * feature is implemented. It's no big deal if ARCHIVE_API_FEATURE != + * archive_api_feature(), as long as both are high enough to include + * the features you're relying on. Specific values of FEATURE are + * documented here: + * + * 1 - Version tests are available. + * 2 - archive_{read,write}_close available separately from _finish. + */ +#define ARCHIVE_API_VERSION 1 +int archive_api_version(void); +#define ARCHIVE_API_FEATURE 2 +int archive_api_feature(void); +/* Textual name/version of the library. */ +#define ARCHIVE_LIBRARY_VERSION "libarchive 1.2.53" +const char * archive_version(void); + +#define ARCHIVE_BYTES_PER_RECORD 512 +#define ARCHIVE_DEFAULT_BYTES_PER_BLOCK 10240 + +/* Declare our basic types. */ +struct archive; +struct archive_entry; + +/* + * Error codes: Use archive_errno() and archive_error_string() + * to retrieve details. Unless specified otherwise, all functions + * that return 'int' use these codes. + */ +#define ARCHIVE_EOF 1 /* Found end of archive. */ +#define ARCHIVE_OK 0 /* Operation was successful. */ +#define ARCHIVE_RETRY (-10) /* Retry might succeed. */ +#define ARCHIVE_WARN (-20) /* Partial sucess. */ +#define ARCHIVE_FATAL (-30) /* No more operations are possible. */ + +/* + * As far as possible, archive_errno returns standard platform errno codes. + * Of course, the details vary by platform, so the actual definitions + * here are stored in "archive_platform.h". The symbols are listed here + * for reference; as a rule, clients should not need to know the exact + * platform-dependent error code. + */ +/* Unrecognized or invalid file format. */ +/* #define ARCHIVE_ERRNO_FILE_FORMAT */ +/* Illegal usage of the library. */ +/* #define ARCHIVE_ERRNO_PROGRAMMER_ERROR */ +/* Unknown or unclassified error. */ +/* #define ARCHIVE_ERRNO_MISC */ + +/* + * Callbacks are invoked to automatically read/skip/write/open/close the + * archive. You can provide your own for complex tasks (like breaking + * archives across multiple tapes) or use standard ones built into the + * library. + */ + +/* Returns pointer and size of next block of data from archive. */ +typedef ssize_t archive_read_callback(struct archive *, void *_client_data, + const void **_buffer); +/* Skips at most request bytes from archive and returns the skipped amount */ +typedef ssize_t archive_skip_callback(struct archive *, void *_client_data, + size_t request); +/* Returns size actually written, zero on EOF, -1 on error. */ +typedef ssize_t archive_write_callback(struct archive *, void *_client_data, + void *_buffer, size_t _length); +typedef int archive_open_callback(struct archive *, void *_client_data); +typedef int archive_close_callback(struct archive *, void *_client_data); + +/* + * Codes for archive_compression. + */ +#define ARCHIVE_COMPRESSION_NONE 0 +#define ARCHIVE_COMPRESSION_GZIP 1 +#define ARCHIVE_COMPRESSION_BZIP2 2 +#define ARCHIVE_COMPRESSION_COMPRESS 3 + +/* + * Codes returned by archive_format. + * + * Top 16 bits identifies the format family (e.g., "tar"); lower + * 16 bits indicate the variant. This is updated by read_next_header. + * Note that the lower 16 bits will often vary from entry to entry. + */ +#define ARCHIVE_FORMAT_BASE_MASK 0xff0000U +#define ARCHIVE_FORMAT_CPIO 0x10000 +#define ARCHIVE_FORMAT_CPIO_POSIX (ARCHIVE_FORMAT_CPIO | 1) +#define ARCHIVE_FORMAT_CPIO_BIN_LE (ARCHIVE_FORMAT_CPIO | 2) +#define ARCHIVE_FORMAT_CPIO_BIN_BE (ARCHIVE_FORMAT_CPIO | 3) +#define ARCHIVE_FORMAT_CPIO_SVR4_NOCRC (ARCHIVE_FORMAT_CPIO | 4) +#define ARCHIVE_FORMAT_CPIO_SVR4_CRC (ARCHIVE_FORMAT_CPIO | 5) +#define ARCHIVE_FORMAT_SHAR 0x20000 +#define ARCHIVE_FORMAT_SHAR_BASE (ARCHIVE_FORMAT_SHAR | 1) +#define ARCHIVE_FORMAT_SHAR_DUMP (ARCHIVE_FORMAT_SHAR | 2) +#define ARCHIVE_FORMAT_TAR 0x30000 +#define ARCHIVE_FORMAT_TAR_USTAR (ARCHIVE_FORMAT_TAR | 1) +#define ARCHIVE_FORMAT_TAR_PAX_INTERCHANGE (ARCHIVE_FORMAT_TAR | 2) +#define ARCHIVE_FORMAT_TAR_PAX_RESTRICTED (ARCHIVE_FORMAT_TAR | 3) +#define ARCHIVE_FORMAT_TAR_GNUTAR (ARCHIVE_FORMAT_TAR | 4) +#define ARCHIVE_FORMAT_ISO9660 0x40000 +#define ARCHIVE_FORMAT_ISO9660_ROCKRIDGE (ARCHIVE_FORMAT_ISO9660 | 1) +#define ARCHIVE_FORMAT_ZIP 0x50000 + +/*- + * Basic outline for reading an archive: + * 1) Ask archive_read_new for an archive reader object. + * 2) Update any global properties as appropriate. + * In particular, you'll certainly want to call appropriate + * archive_read_support_XXX functions. + * 3) Call archive_read_open_XXX to open the archive + * 4) Repeatedly call archive_read_next_header to get information about + * successive archive entries. Call archive_read_data to extract + * data for entries of interest. + * 5) Call archive_read_finish to end processing. + */ +struct archive *archive_read_new(void); + +/* + * The archive_read_support_XXX calls enable auto-detect for this + * archive handle. They also link in the necessary support code. + * For example, if you don't want bzlib linked in, don't invoke + * support_compression_bzip2(). The "all" functions provide the + * obvious shorthand. + */ +int archive_read_support_compression_all(struct archive *); +int archive_read_support_compression_bzip2(struct archive *); +int archive_read_support_compression_compress(struct archive *); +int archive_read_support_compression_gzip(struct archive *); +int archive_read_support_compression_none(struct archive *); + +int archive_read_support_format_all(struct archive *); +int archive_read_support_format_cpio(struct archive *); +int archive_read_support_format_gnutar(struct archive *); +int archive_read_support_format_iso9660(struct archive *); +int archive_read_support_format_tar(struct archive *); +int archive_read_support_format_zip(struct archive *); + + +/* Open the archive using callbacks for archive I/O. */ +int archive_read_open(struct archive *, void *_client_data, + archive_open_callback *, archive_read_callback *, + archive_close_callback *); +int archive_read_open2(struct archive *, void *_client_data, + archive_open_callback *, archive_read_callback *, + archive_skip_callback *, archive_close_callback *); + +/* + * The archive_read_open_file function is a convenience function built + * on archive_read_open that uses a canned callback suitable for + * common situations. Note that a NULL filename indicates stdin. + */ +int archive_read_open_file(struct archive *, const char *_file, + size_t _block_size); +int archive_read_open_fd(struct archive *, int _fd, + size_t _block_size); + +/* Parses and returns next entry header. */ +int archive_read_next_header(struct archive *, + struct archive_entry **); + +/* + * Retrieve the byte offset in UNCOMPRESSED data where last-read + * header started. + */ +int64_t archive_read_header_position(struct archive *); + +/* Read data from the body of an entry. Similar to read(2). */ +ssize_t archive_read_data(struct archive *, void *, size_t); +/* + * A zero-copy version of archive_read_data that also exposes the file offset + * of each returned block. Note that the client has no way to specify + * the desired size of the block. The API does gaurantee that offsets will + * be strictly increasing and that returned blocks will not overlap. + */ +int archive_read_data_block(struct archive *a, + const void **buff, size_t *size, off_t *offset); + +/*- + * Some convenience functions that are built on archive_read_data: + * 'skip': skips entire entry + * 'into_buffer': writes data into memory buffer that you provide + * 'into_fd': writes data to specified filedes + */ +int archive_read_data_skip(struct archive *); +int archive_read_data_into_buffer(struct archive *, void *buffer, + ssize_t len); +int archive_read_data_into_fd(struct archive *, int fd); + +/*- + * Convenience function to recreate the current entry (whose header + * has just been read) on disk. + * + * This does quite a bit more than just copy data to disk. It also: + * - Creates intermediate directories as required. + * - Manages directory permissions: non-writable directories will + * be initially created with write permission enabled; when the + * archive is closed, dir permissions are edited to the values specified + * in the archive. + * - Checks hardlinks: hardlinks will not be extracted unless the + * linked-to file was also extracted within the same session. (TODO) + */ + +/* The "flags" argument selects optional behavior, 'OR' the flags you want. */ +/* TODO: The 'Default' comments here are not quite correct; clean this up. */ +#define ARCHIVE_EXTRACT_OWNER (1) /* Default: owner/group not restored */ +#define ARCHIVE_EXTRACT_PERM (2) /* Default: restore perm only for reg file*/ +#define ARCHIVE_EXTRACT_TIME (4) /* Default: mod time not restored */ +#define ARCHIVE_EXTRACT_NO_OVERWRITE (8) /* Default: Replace files on disk */ +#define ARCHIVE_EXTRACT_UNLINK (16) /* Default: don't unlink existing files */ +#define ARCHIVE_EXTRACT_ACL (32) /* Default: don't restore ACLs */ +#define ARCHIVE_EXTRACT_FFLAGS (64) /* Default: don't restore fflags */ +#define ARCHIVE_EXTRACT_XATTR (128) /* Default: don't restore xattrs */ + +int archive_read_extract(struct archive *, struct archive_entry *, + int flags); +void archive_read_extract_set_progress_callback(struct archive *, + void (*_progress_func)(void *), void *_user_data); + +/* Close the file and release most resources. */ +int archive_read_close(struct archive *); +/* Release all resources and destroy the object. */ +/* Note that archive_read_finish will call archive_read_close for you. */ +void archive_read_finish(struct archive *); + +/*- + * To create an archive: + * 1) Ask archive_write_new for a archive writer object. + * 2) Set any global properties. In particular, you should set + * the compression and format to use. + * 3) Call archive_write_open to open the file (most people + * will use archive_write_open_file or archive_write_open_fd, + * which provide convenient canned I/O callbacks for you). + * 4) For each entry: + * - construct an appropriate struct archive_entry structure + * - archive_write_header to write the header + * - archive_write_data to write the entry data + * 5) archive_write_close to close the output + * 6) archive_write_finish to cleanup the writer and release resources + */ +struct archive *archive_write_new(void); +int archive_write_set_bytes_per_block(struct archive *, + int bytes_per_block); +/* XXX This is badly misnamed; suggestions appreciated. XXX */ +int archive_write_set_bytes_in_last_block(struct archive *, + int bytes_in_last_block); + +int archive_write_set_compression_bzip2(struct archive *); +int archive_write_set_compression_gzip(struct archive *); +int archive_write_set_compression_none(struct archive *); +/* A convenience function to set the format based on the code or name. */ +int archive_write_set_format(struct archive *, int format_code); +int archive_write_set_format_by_name(struct archive *, + const char *name); +/* To minimize link pollution, use one or more of the following. */ +int archive_write_set_format_cpio(struct archive *); +/* TODO: int archive_write_set_format_old_tar(struct archive *); */ +int archive_write_set_format_pax(struct archive *); +int archive_write_set_format_pax_restricted(struct archive *); +int archive_write_set_format_shar(struct archive *); +int archive_write_set_format_shar_dump(struct archive *); +int archive_write_set_format_ustar(struct archive *); +int archive_write_open(struct archive *, void *, + archive_open_callback *, archive_write_callback *, + archive_close_callback *); +int archive_write_open_fd(struct archive *, int _fd); +int archive_write_open_file(struct archive *, const char *_file); + +/* + * Note that the library will truncate writes beyond the size provided + * to archive_write_header or pad if the provided data is short. + */ +int archive_write_header(struct archive *, + struct archive_entry *); +/* TODO: should be ssize_t, but that might require .so version bump? */ +int archive_write_data(struct archive *, const void *, size_t); +int archive_write_close(struct archive *); +void archive_write_finish(struct archive *); + +/* + * Accessor functions to read/set various information in + * the struct archive object: + */ +/* Bytes written after compression or read before decompression. */ +int64_t archive_position_compressed(struct archive *); +/* Bytes written to compressor or read from decompressor. */ +int64_t archive_position_uncompressed(struct archive *); + +const char *archive_compression_name(struct archive *); +int archive_compression(struct archive *); +int archive_errno(struct archive *); +const char *archive_error_string(struct archive *); +const char *archive_format_name(struct archive *); +int archive_format(struct archive *); +void archive_set_error(struct archive *, int _err, const char *fmt, ...); + +#ifdef __cplusplus +} +#endif + +#endif /* !ARCHIVE_H_INCLUDED */ diff --git a/src/include.new/archive_entry.h b/src/include.new/archive_entry.h new file mode 100644 index 0000000..a9b4412 --- /dev/null +++ b/src/include.new/archive_entry.h @@ -0,0 +1,251 @@ +/*- + * Copyright (c) 2003-2004 Tim Kientzle + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer + * in this position and unchanged. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * $FreeBSD: src/lib/libarchive/archive_entry.h,v 1.16.2.1 2006/07/30 06:30:00 kientzle Exp $ + */ + +#ifndef ARCHIVE_ENTRY_H_INCLUDED +#define ARCHIVE_ENTRY_H_INCLUDED + +#include /* for wchar_t */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + + +/* + * Description of an archive entry. + * + * Basically, a "struct stat" with a few text fields added in. + * + * TODO: Add "comment", "charset", and possibly other entries that are + * supported by "pax interchange" format. However, GNU, ustar, cpio, + * and other variants don't support these features, so they're not an + * excruciatingly high priority right now. + * + * TODO: "pax interchange" format allows essentially arbitrary + * key/value attributes to be attached to any entry. Supporting + * such extensions may make this library useful for special + * applications (e.g., a package manager could attach special + * package-management attributes to each entry). + */ +struct archive_entry; + +/* + * Basic object manipulation + */ + +struct archive_entry *archive_entry_clear(struct archive_entry *); +/* The 'clone' function does a deep copy; all of the strings are copied too. */ +struct archive_entry *archive_entry_clone(struct archive_entry *); +void archive_entry_free(struct archive_entry *); +struct archive_entry *archive_entry_new(void); + +/* + * Retrieve fields from an archive_entry. + */ + +time_t archive_entry_atime(struct archive_entry *); +long archive_entry_atime_nsec(struct archive_entry *); +time_t archive_entry_ctime(struct archive_entry *); +long archive_entry_ctime_nsec(struct archive_entry *); +dev_t archive_entry_dev(struct archive_entry *); +void archive_entry_fflags(struct archive_entry *, + unsigned long *set, unsigned long *clear); +const char *archive_entry_fflags_text(struct archive_entry *); +gid_t archive_entry_gid(struct archive_entry *); +const char *archive_entry_gname(struct archive_entry *); +const wchar_t *archive_entry_gname_w(struct archive_entry *); +const char *archive_entry_hardlink(struct archive_entry *); +const wchar_t *archive_entry_hardlink_w(struct archive_entry *); +ino_t archive_entry_ino(struct archive_entry *); +mode_t archive_entry_mode(struct archive_entry *); +time_t archive_entry_mtime(struct archive_entry *); +long archive_entry_mtime_nsec(struct archive_entry *); +const char *archive_entry_pathname(struct archive_entry *); +const wchar_t *archive_entry_pathname_w(struct archive_entry *); +dev_t archive_entry_rdev(struct archive_entry *); +dev_t archive_entry_rdevmajor(struct archive_entry *); +dev_t archive_entry_rdevminor(struct archive_entry *); +int64_t archive_entry_size(struct archive_entry *); +const struct stat *archive_entry_stat(struct archive_entry *); +const char *archive_entry_symlink(struct archive_entry *); +const wchar_t *archive_entry_symlink_w(struct archive_entry *); +uid_t archive_entry_uid(struct archive_entry *); +const char *archive_entry_uname(struct archive_entry *); +const wchar_t *archive_entry_uname_w(struct archive_entry *); + +/* + * Set fields in an archive_entry. + * + * Note that string 'set' functions do not copy the string, only the pointer. + * In contrast, 'copy' functions do copy the object pointed to. + */ + +void archive_entry_copy_stat(struct archive_entry *, const struct stat *); +void archive_entry_set_atime(struct archive_entry *, time_t, long); +void archive_entry_set_ctime(struct archive_entry *, time_t, long); +void archive_entry_set_fflags(struct archive_entry *, + unsigned long set, unsigned long clear); +/* Returns pointer to start of first invalid token, or NULL if none. */ +/* Note that all recognized tokens are processed, regardless. */ +const wchar_t *archive_entry_copy_fflags_text_w(struct archive_entry *, + const wchar_t *); +void archive_entry_set_gid(struct archive_entry *, gid_t); +void archive_entry_set_gname(struct archive_entry *, const char *); +void archive_entry_copy_gname_w(struct archive_entry *, const wchar_t *); +void archive_entry_set_hardlink(struct archive_entry *, const char *); +void archive_entry_copy_hardlink(struct archive_entry *, const char *); +void archive_entry_copy_hardlink_w(struct archive_entry *, const wchar_t *); +void archive_entry_set_link(struct archive_entry *, const char *); +void archive_entry_set_mode(struct archive_entry *, mode_t); +void archive_entry_set_mtime(struct archive_entry *, time_t, long); +void archive_entry_set_pathname(struct archive_entry *, const char *); +void archive_entry_copy_pathname(struct archive_entry *, const char *); +void archive_entry_copy_pathname_w(struct archive_entry *, const wchar_t *); +void archive_entry_set_rdevmajor(struct archive_entry *, dev_t); +void archive_entry_set_rdevminor(struct archive_entry *, dev_t); +void archive_entry_set_size(struct archive_entry *, int64_t); +void archive_entry_set_symlink(struct archive_entry *, const char *); +void archive_entry_copy_symlink_w(struct archive_entry *, const wchar_t *); +void archive_entry_set_uid(struct archive_entry *, uid_t); +void archive_entry_set_uname(struct archive_entry *, const char *); +void archive_entry_copy_uname_w(struct archive_entry *, const wchar_t *); + +/* + * ACL routines. This used to simply store and return text-format ACL + * strings, but that proved insufficient for a number of reasons: + * = clients need control over uname/uid and gname/gid mappings + * = there are many different ACL text formats + * = would like to be able to read/convert archives containing ACLs + * on platforms that lack ACL libraries + */ + +/* + * Permission bits mimic POSIX.1e. Note that I've not followed POSIX.1e's + * "permset"/"perm" abstract type nonsense. A permset is just a simple + * bitmap, following long-standing Unix tradition. + */ +#define ARCHIVE_ENTRY_ACL_EXECUTE 1 +#define ARCHIVE_ENTRY_ACL_WRITE 2 +#define ARCHIVE_ENTRY_ACL_READ 4 + +/* We need to be able to specify either or both of these. */ +#define ARCHIVE_ENTRY_ACL_TYPE_ACCESS 256 +#define ARCHIVE_ENTRY_ACL_TYPE_DEFAULT 512 + +/* Tag values mimic POSIX.1e */ +#define ARCHIVE_ENTRY_ACL_USER 10001 /* Specified user. */ +#define ARCHIVE_ENTRY_ACL_USER_OBJ 10002 /* User who owns the file. */ +#define ARCHIVE_ENTRY_ACL_GROUP 10003 /* Specified group. */ +#define ARCHIVE_ENTRY_ACL_GROUP_OBJ 10004 /* Group who owns the file. */ +#define ARCHIVE_ENTRY_ACL_MASK 10005 /* Modify group access. */ +#define ARCHIVE_ENTRY_ACL_OTHER 10006 /* Public. */ + +/* + * Set the ACL by clearing it and adding entries one at a time. + * Unlike the POSIX.1e ACL routines, you must specify the type + * (access/default) for each entry. Internally, the ACL data is just + * a soup of entries. API calls here allow you to retrieve just the + * entries of interest. This design (which goes against the spirit of + * POSIX.1e) is useful for handling archive formats that combine + * default and access information in a single ACL list. + */ +void archive_entry_acl_clear(struct archive_entry *); +void archive_entry_acl_add_entry(struct archive_entry *, + int type, int permset, int tag, int qual, const char *name); +void archive_entry_acl_add_entry_w(struct archive_entry *, + int type, int permset, int tag, int qual, const wchar_t *name); + +/* + * To retrieve the ACL, first "reset", then repeatedly ask for the + * "next" entry. The want_type parameter allows you to request only + * access entries or only default entries. + */ +int archive_entry_acl_reset(struct archive_entry *, int want_type); +int archive_entry_acl_next(struct archive_entry *, int want_type, + int *type, int *permset, int *tag, int *qual, const char **name); +int archive_entry_acl_next_w(struct archive_entry *, int want_type, + int *type, int *permset, int *tag, int *qual, + const wchar_t **name); + +/* + * Construct a text-format ACL. The flags argument is a bitmask that + * can include any of the following: + * + * ARCHIVE_ENTRY_ACL_TYPE_ACCESS - Include access entries. + * ARCHIVE_ENTRY_ACL_TYPE_DEFAULT - Include default entries. + * ARCHIVE_ENTRY_ACL_STYLE_EXTRA_ID - Include extra numeric ID field in + * each ACL entry. (As used by 'star'.) + * ARCHIVE_ENTRY_ACL_STYLE_MARK_DEFAULT - Include "default:" before each + * default ACL entry. + */ +#define ARCHIVE_ENTRY_ACL_STYLE_EXTRA_ID 1024 +#define ARCHIVE_ENTRY_ACL_STYLE_MARK_DEFAULT 2048 +const wchar_t *archive_entry_acl_text_w(struct archive_entry *, int flags); + +/* Return a count of entries matching 'want_type' */ +int archive_entry_acl_count(struct archive_entry *, int want_type); + +/* + * Private ACL parser. This is private because it handles some + * very weird formats that clients should not be messing with. + * Clients should only deal with their platform-native formats. + * Because of the need to support many formats cleanly, new arguments + * are likely to get added on a regular basis. Clients who try to use + * this interface are likely to be surprised when it changes. + * + * You were warned! + */ +int __archive_entry_acl_parse_w(struct archive_entry *, + const wchar_t *, int type); + + +#ifdef __cplusplus +} +#endif + +/* + * extended attributes + */ + +void archive_entry_xattr_clear(struct archive_entry *); +void archive_entry_xattr_add_entry(struct archive_entry *, + const char *name, const void *value, size_t size); + +/* + * To retrieve the xattr list, first "reset", then repeatedly ask for the + * "next" entry. + */ + +int archive_entry_xattr_count(struct archive_entry *); +int archive_entry_xattr_reset(struct archive_entry *); +int archive_entry_xattr_next(struct archive_entry *, + const char **name, const void **value, size_t *); + + +#endif /* !ARCHIVE_ENTRY_H_INCLUDED */ diff --git a/src/include.new/asn1_err.h b/src/include.new/asn1_err.h new file mode 100644 index 0000000..0604cbf --- /dev/null +++ b/src/include.new/asn1_err.h @@ -0,0 +1,29 @@ +/* Generated from /usr/src/kerberos5/lib/libasn1/../../../crypto/heimdal/lib/asn1/asn1_err.et */ +/* $Id$ */ + +#ifndef __asn1_err_h__ +#define __asn1_err_h__ + +struct et_list; + +void initialize_asn1_error_table_r(struct et_list **); + +void initialize_asn1_error_table(void); +#define init_asn1_err_tbl initialize_asn1_error_table + +typedef enum asn1_error_number{ + ASN1_BAD_TIMEFORMAT = 1859794432, + ASN1_MISSING_FIELD = 1859794433, + ASN1_MISPLACED_FIELD = 1859794434, + ASN1_TYPE_MISMATCH = 1859794435, + ASN1_OVERFLOW = 1859794436, + ASN1_OVERRUN = 1859794437, + ASN1_BAD_ID = 1859794438, + ASN1_BAD_LENGTH = 1859794439, + ASN1_BAD_FORMAT = 1859794440, + ASN1_PARSE_ERROR = 1859794441 +} asn1_error_number; + +#define ERROR_TABLE_BASE_asn1 1859794432 + +#endif /* __asn1_err_h__ */ diff --git a/src/include.new/assert.h b/src/include.new/assert.h new file mode 100644 index 0000000..5ad0135 --- /dev/null +++ b/src/include.new/assert.h @@ -0,0 +1,64 @@ +/*- + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * (c) UNIX System Laboratories, Inc. + * All or some portions of this file are derived from material licensed + * to the University of California by American Telephone and Telegraph + * Co. or Unix System Laboratories, Inc. and are reproduced herein with + * the permission of UNIX System Laboratories, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)assert.h 8.2 (Berkeley) 1/21/94 + * $FreeBSD: src/include/assert.h,v 1.4 2002/03/23 17:24:53 imp Exp $ + */ + +#include + +/* + * Unlike other ANSI header files, may usefully be included + * multiple times, with and without NDEBUG defined. + */ + +#undef assert +#undef _assert + +#ifdef NDEBUG +#define assert(e) ((void)0) +#define _assert(e) ((void)0) +#else +#define _assert(e) assert(e) + +#define assert(e) ((e) ? (void)0 : __assert(__func__, __FILE__, \ + __LINE__, #e)) +#endif /* NDEBUG */ + +__BEGIN_DECLS +void __assert(const char *, const char *, int, const char *); +__END_DECLS diff --git a/src/include.new/bitstring.h b/src/include.new/bitstring.h new file mode 100644 index 0000000..3dfb955 --- /dev/null +++ b/src/include.new/bitstring.h @@ -0,0 +1,35 @@ +/*- + * Copyright (c) 2003 Poul-Henning Kamp + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD: src/include/bitstring.h,v 1.3 2003/06/13 19:40:13 phk Exp $ + */ + +#ifndef _BITSTRING_H_ +#define _BITSTRING_H_ + +#include + +#endif /* _BITSTRING_H_ */ + diff --git a/src/include.new/bluetooth.h b/src/include.new/bluetooth.h new file mode 100644 index 0000000..4967112 --- /dev/null +++ b/src/include.new/bluetooth.h @@ -0,0 +1,78 @@ +/* + * bluetooth.h + * + * Copyright (c) 2001-2003 Maksim Yevmenkin + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $Id$ + * $FreeBSD: src/lib/libbluetooth/bluetooth.h,v 1.2 2005/03/17 21:39:44 emax Exp $ + */ + +#ifndef _BLUETOOTH_H_ +#define _BLUETOOTH_H_ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +__BEGIN_DECLS + +/* + * Linux BlueZ compatibility + */ + +#define bacmp(ba1, ba2) memcmp((ba1), (ba2), sizeof(bdaddr_t)) +#define bacpy(dst, src) memcpy((dst), (src), sizeof(bdaddr_t)) +#define ba2str(ba, str) bt_ntoa((ba), (str)) +#define str2ba(str, ba) (bt_aton((str), (ba)) == 1? 0 : -1) + +/* + * Interface to the outside world + */ + +struct hostent * bt_gethostbyname (char const *name); +struct hostent * bt_gethostbyaddr (char const *addr, int len, int type); +struct hostent * bt_gethostent (void); +void bt_sethostent (int stayopen); +void bt_endhostent (void); + +struct protoent * bt_getprotobyname (char const *name); +struct protoent * bt_getprotobynumber (int proto); +struct protoent * bt_getprotoent (void); +void bt_setprotoent (int stayopen); +void bt_endprotoent (void); + +char const * bt_ntoa (bdaddr_t const *ba, char *str); +int bt_aton (char const *str, bdaddr_t *ba); + +__END_DECLS + +#endif /* ndef _BLUETOOTH_H_ */ + diff --git a/src/include.new/bsdxml.h b/src/include.new/bsdxml.h new file mode 100644 index 0000000..2694dbd --- /dev/null +++ b/src/include.new/bsdxml.h @@ -0,0 +1,901 @@ +/* Copyright (c) 1998, 1999, 2000 Thai Open Source Software Center Ltd + See the file src/contrib/expat/COPYING for copying permission. +*/ + +#ifndef _BSD_XML_H_ +#define _BSD_XML_H_ 1 + + +#include + +#ifndef XMLPARSEAPI +#if defined(_MSC_EXTENSIONS) && !defined(__BEOS__) && !defined(__CYGWIN__) +#ifdef _STATIC +#define XMLPARSEAPI(type) type __cdecl +#else +#define XMLPARSEAPI(type) __declspec(dllimport) type __cdecl +#endif +#else +#define XMLPARSEAPI(type) type +#endif +#endif /* not defined XMLPARSEAPI */ + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef XML_UNICODE_WCHAR_T +#define XML_UNICODE +#endif + +struct XML_ParserStruct; +typedef struct XML_ParserStruct *XML_Parser; + +#ifdef XML_UNICODE /* Information is UTF-16 encoded. */ +#ifdef XML_UNICODE_WCHAR_T +typedef wchar_t XML_Char; +typedef wchar_t XML_LChar; +#else +typedef unsigned short XML_Char; +typedef char XML_LChar; +#endif /* XML_UNICODE_WCHAR_T */ +#else /* Information is UTF-8 encoded. */ +typedef char XML_Char; +typedef char XML_LChar; +#endif /* XML_UNICODE */ + +/* Should this be defined using stdbool.h when C99 is available? */ +typedef unsigned char XML_Bool; +#define XML_TRUE ((XML_Bool) 1) +#define XML_FALSE ((XML_Bool) 0) + +enum XML_Error { + XML_ERROR_NONE, + XML_ERROR_NO_MEMORY, + XML_ERROR_SYNTAX, + XML_ERROR_NO_ELEMENTS, + XML_ERROR_INVALID_TOKEN, + XML_ERROR_UNCLOSED_TOKEN, + XML_ERROR_PARTIAL_CHAR, + XML_ERROR_TAG_MISMATCH, + XML_ERROR_DUPLICATE_ATTRIBUTE, + XML_ERROR_JUNK_AFTER_DOC_ELEMENT, + XML_ERROR_PARAM_ENTITY_REF, + XML_ERROR_UNDEFINED_ENTITY, + XML_ERROR_RECURSIVE_ENTITY_REF, + XML_ERROR_ASYNC_ENTITY, + XML_ERROR_BAD_CHAR_REF, + XML_ERROR_BINARY_ENTITY_REF, + XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF, + XML_ERROR_MISPLACED_XML_PI, + XML_ERROR_UNKNOWN_ENCODING, + XML_ERROR_INCORRECT_ENCODING, + XML_ERROR_UNCLOSED_CDATA_SECTION, + XML_ERROR_EXTERNAL_ENTITY_HANDLING, + XML_ERROR_NOT_STANDALONE, + XML_ERROR_UNEXPECTED_STATE, + XML_ERROR_ENTITY_DECLARED_IN_PE, + XML_ERROR_FEATURE_REQUIRES_XML_DTD, + XML_ERROR_CANT_CHANGE_FEATURE_ONCE_PARSING +}; + +enum XML_Content_Type { + XML_CTYPE_EMPTY = 1, + XML_CTYPE_ANY, + XML_CTYPE_MIXED, + XML_CTYPE_NAME, + XML_CTYPE_CHOICE, + XML_CTYPE_SEQ +}; + +enum XML_Content_Quant { + XML_CQUANT_NONE, + XML_CQUANT_OPT, + XML_CQUANT_REP, + XML_CQUANT_PLUS +}; + +/* If type == XML_CTYPE_EMPTY or XML_CTYPE_ANY, then quant will be + XML_CQUANT_NONE, and the other fields will be zero or NULL. + If type == XML_CTYPE_MIXED, then quant will be NONE or REP and + numchildren will contain number of elements that may be mixed in + and children point to an array of XML_Content cells that will be + all of XML_CTYPE_NAME type with no quantification. + + If type == XML_CTYPE_NAME, then the name points to the name, and + the numchildren field will be zero and children will be NULL. The + quant fields indicates any quantifiers placed on the name. + + CHOICE and SEQ will have name NULL, the number of children in + numchildren and children will point, recursively, to an array + of XML_Content cells. + + The EMPTY, ANY, and MIXED types will only occur at top level. +*/ + +typedef struct XML_cp XML_Content; + +struct XML_cp { + enum XML_Content_Type type; + enum XML_Content_Quant quant; + XML_Char * name; + unsigned int numchildren; + XML_Content * children; +}; + + +/* This is called for an element declaration. See above for + description of the model argument. It's the caller's responsibility + to free model when finished with it. +*/ +typedef void (*XML_ElementDeclHandler) (void *userData, + const XML_Char *name, + XML_Content *model); + +XMLPARSEAPI(void) +XML_SetElementDeclHandler(XML_Parser parser, + XML_ElementDeclHandler eldecl); + +/* The Attlist declaration handler is called for *each* attribute. So + a single Attlist declaration with multiple attributes declared will + generate multiple calls to this handler. The "default" parameter + may be NULL in the case of the "#IMPLIED" or "#REQUIRED" + keyword. The "isrequired" parameter will be true and the default + value will be NULL in the case of "#REQUIRED". If "isrequired" is + true and default is non-NULL, then this is a "#FIXED" default. +*/ +typedef void (*XML_AttlistDeclHandler) (void *userData, + const XML_Char *elname, + const XML_Char *attname, + const XML_Char *att_type, + const XML_Char *dflt, + int isrequired); + +XMLPARSEAPI(void) +XML_SetAttlistDeclHandler(XML_Parser parser, + XML_AttlistDeclHandler attdecl); + +/* The XML declaration handler is called for *both* XML declarations + and text declarations. The way to distinguish is that the version + parameter will be NULL for text declarations. The encoding + parameter may be NULL for XML declarations. The standalone + parameter will be -1, 0, or 1 indicating respectively that there + was no standalone parameter in the declaration, that it was given + as no, or that it was given as yes. +*/ +typedef void (*XML_XmlDeclHandler) (void *userData, + const XML_Char *version, + const XML_Char *encoding, + int standalone); + +XMLPARSEAPI(void) +XML_SetXmlDeclHandler(XML_Parser parser, + XML_XmlDeclHandler xmldecl); + + +typedef struct { + void *(*malloc_fcn)(size_t size); + void *(*realloc_fcn)(void *ptr, size_t size); + void (*free_fcn)(void *ptr); +} XML_Memory_Handling_Suite; + +/* Constructs a new parser; encoding is the encoding specified by the + external protocol or NULL if there is none specified. +*/ +XMLPARSEAPI(XML_Parser) +XML_ParserCreate(const XML_Char *encoding); + +/* Constructs a new parser and namespace processor. Element type + names and attribute names that belong to a namespace will be + expanded; unprefixed attribute names are never expanded; unprefixed + element type names are expanded only if there is a default + namespace. The expanded name is the concatenation of the namespace + URI, the namespace separator character, and the local part of the + name. If the namespace separator is '\0' then the namespace URI + and the local part will be concatenated without any separator. + When a namespace is not declared, the name and prefix will be + passed through without expansion. +*/ +XMLPARSEAPI(XML_Parser) +XML_ParserCreateNS(const XML_Char *encoding, XML_Char namespaceSeparator); + + +/* Constructs a new parser using the memory management suit referred to + by memsuite. If memsuite is NULL, then use the standard library memory + suite. If namespaceSeparator is non-NULL it creates a parser with + namespace processing as described above. The character pointed at + will serve as the namespace separator. + + All further memory operations used for the created parser will come from + the given suite. +*/ +XMLPARSEAPI(XML_Parser) +XML_ParserCreate_MM(const XML_Char *encoding, + const XML_Memory_Handling_Suite *memsuite, + const XML_Char *namespaceSeparator); + +/* Prepare a parser object to be re-used. This is particularly + valuable when memory allocation overhead is disproportionatly high, + such as when a large number of small documnents need to be parsed. + All handlers are cleared from the parser, except for the + unknownEncodingHandler. The parser's external state is re-initialized + except for the values of ns and ns_triplets. + + Added in Expat 1.95.3. +*/ +XMLPARSEAPI(XML_Bool) +XML_ParserReset(XML_Parser parser, const XML_Char *encoding); + +/* atts is array of name/value pairs, terminated by 0; + names and values are 0 terminated. +*/ +typedef void (*XML_StartElementHandler)(void *userData, + const XML_Char *name, + const XML_Char **atts); + +typedef void (*XML_EndElementHandler)(void *userData, + const XML_Char *name); + + +/* s is not 0 terminated. */ +typedef void (*XML_CharacterDataHandler)(void *userData, + const XML_Char *s, + int len); + +/* target and data are 0 terminated */ +typedef void (*XML_ProcessingInstructionHandler)(void *userData, + const XML_Char *target, + const XML_Char *data); + +/* data is 0 terminated */ +typedef void (*XML_CommentHandler)(void *userData, const XML_Char *data); + +typedef void (*XML_StartCdataSectionHandler)(void *userData); +typedef void (*XML_EndCdataSectionHandler)(void *userData); + +/* This is called for any characters in the XML document for which + there is no applicable handler. This includes both characters that + are part of markup which is of a kind that is not reported + (comments, markup declarations), or characters that are part of a + construct which could be reported but for which no handler has been + supplied. The characters are passed exactly as they were in the XML + document except that they will be encoded in UTF-8 or UTF-16. + Line boundaries are not normalized. Note that a byte order mark + character is not passed to the default handler. There are no + guarantees about how characters are divided between calls to the + default handler: for example, a comment might be split between + multiple calls. +*/ +typedef void (*XML_DefaultHandler)(void *userData, + const XML_Char *s, + int len); + +/* This is called for the start of the DOCTYPE declaration, before + any DTD or internal subset is parsed. +*/ +typedef void (*XML_StartDoctypeDeclHandler)(void *userData, + const XML_Char *doctypeName, + const XML_Char *sysid, + const XML_Char *pubid, + int has_internal_subset); + +/* This is called for the start of the DOCTYPE declaration when the + closing > is encountered, but after processing any external + subset. +*/ +typedef void (*XML_EndDoctypeDeclHandler)(void *userData); + +/* This is called for entity declarations. The is_parameter_entity + argument will be non-zero if the entity is a parameter entity, zero + otherwise. + + For internal entities (), value will + be non-NULL and systemId, publicID, and notationName will be NULL. + The value string is NOT nul-terminated; the length is provided in + the value_length argument. Since it is legal to have zero-length + values, do not use this argument to test for internal entities. + + For external entities, value will be NULL and systemId will be + non-NULL. The publicId argument will be NULL unless a public + identifier was provided. The notationName argument will have a + non-NULL value only for unparsed entity declarations. + + Note that is_parameter_entity can't be changed to XML_Bool, since + that would break binary compatibility. +*/ +typedef void (*XML_EntityDeclHandler) (void *userData, + const XML_Char *entityName, + int is_parameter_entity, + const XML_Char *value, + int value_length, + const XML_Char *base, + const XML_Char *systemId, + const XML_Char *publicId, + const XML_Char *notationName); + +XMLPARSEAPI(void) +XML_SetEntityDeclHandler(XML_Parser parser, + XML_EntityDeclHandler handler); + +/* OBSOLETE -- OBSOLETE -- OBSOLETE + This handler has been superceded by the EntityDeclHandler above. + It is provided here for backward compatibility. + + This is called for a declaration of an unparsed (NDATA) entity. + The base argument is whatever was set by XML_SetBase. The + entityName, systemId and notationName arguments will never be + NULL. The other arguments may be. +*/ +typedef void (*XML_UnparsedEntityDeclHandler)(void *userData, + const XML_Char *entityName, + const XML_Char *base, + const XML_Char *systemId, + const XML_Char *publicId, + const XML_Char *notationName); + +/* This is called for a declaration of notation. The base argument is + whatever was set by XML_SetBase. The notationName will never be + NULL. The other arguments can be. +*/ +typedef void (*XML_NotationDeclHandler)(void *userData, + const XML_Char *notationName, + const XML_Char *base, + const XML_Char *systemId, + const XML_Char *publicId); + +/* When namespace processing is enabled, these are called once for + each namespace declaration. The call to the start and end element + handlers occur between the calls to the start and end namespace + declaration handlers. For an xmlns attribute, prefix will be + NULL. For an xmlns="" attribute, uri will be NULL. +*/ +typedef void (*XML_StartNamespaceDeclHandler)(void *userData, + const XML_Char *prefix, + const XML_Char *uri); + +typedef void (*XML_EndNamespaceDeclHandler)(void *userData, + const XML_Char *prefix); + +/* This is called if the document is not standalone, that is, it has an + external subset or a reference to a parameter entity, but does not + have standalone="yes". If this handler returns 0, then processing + will not continue, and the parser will return a + XML_ERROR_NOT_STANDALONE error. + If parameter entity parsing is enabled, then in addition to the + conditions above this handler will only be called if the referenced + entity was actually read. +*/ +typedef int (*XML_NotStandaloneHandler)(void *userData); + +/* This is called for a reference to an external parsed general + entity. The referenced entity is not automatically parsed. The + application can parse it immediately or later using + XML_ExternalEntityParserCreate. + + The parser argument is the parser parsing the entity containing the + reference; it can be passed as the parser argument to + XML_ExternalEntityParserCreate. The systemId argument is the + system identifier as specified in the entity declaration; it will + not be NULL. + + The base argument is the system identifier that should be used as + the base for resolving systemId if systemId was relative; this is + set by XML_SetBase; it may be NULL. + + The publicId argument is the public identifier as specified in the + entity declaration, or NULL if none was specified; the whitespace + in the public identifier will have been normalized as required by + the XML spec. + + The context argument specifies the parsing context in the format + expected by the context argument to XML_ExternalEntityParserCreate; + context is valid only until the handler returns, so if the + referenced entity is to be parsed later, it must be copied. + + The handler should return 0 if processing should not continue + because of a fatal error in the handling of the external entity. + In this case the calling parser will return an + XML_ERROR_EXTERNAL_ENTITY_HANDLING error. + + Note that unlike other handlers the first argument is the parser, + not userData. +*/ +typedef int (*XML_ExternalEntityRefHandler)(XML_Parser parser, + const XML_Char *context, + const XML_Char *base, + const XML_Char *systemId, + const XML_Char *publicId); + +/* This is called in two situations: + 1) An entity reference is encountered for which no declaration + has been read *and* this is not an error. + 2) An internal entity reference is read, but not expanded, because + XML_SetDefaultHandler has been called. + Note: skipped parameter entities in declarations and skipped general + entities in attribute values cannot be reported, because + the event would be out of sync with the reporting of the + declarations or attribute values +*/ +typedef void (*XML_SkippedEntityHandler)(void *userData, + const XML_Char *entityName, + int is_parameter_entity); + +/* This structure is filled in by the XML_UnknownEncodingHandler to + provide information to the parser about encodings that are unknown + to the parser. + + The map[b] member gives information about byte sequences whose + first byte is b. + + If map[b] is c where c is >= 0, then b by itself encodes the + Unicode scalar value c. + + If map[b] is -1, then the byte sequence is malformed. + + If map[b] is -n, where n >= 2, then b is the first byte of an + n-byte sequence that encodes a single Unicode scalar value. + + The data member will be passed as the first argument to the convert + function. + + The convert function is used to convert multibyte sequences; s will + point to a n-byte sequence where map[(unsigned char)*s] == -n. The + convert function must return the Unicode scalar value represented + by this byte sequence or -1 if the byte sequence is malformed. + + The convert function may be NULL if the encoding is a single-byte + encoding, that is if map[b] >= -1 for all bytes b. + + When the parser is finished with the encoding, then if release is + not NULL, it will call release passing it the data member; once + release has been called, the convert function will not be called + again. + + Expat places certain restrictions on the encodings that are supported + using this mechanism. + + 1. Every ASCII character that can appear in a well-formed XML document, + other than the characters + + $@\^`{}~ + + must be represented by a single byte, and that byte must be the + same byte that represents that character in ASCII. + + 2. No character may require more than 4 bytes to encode. + + 3. All characters encoded must have Unicode scalar values <= + 0xFFFF, (i.e., characters that would be encoded by surrogates in + UTF-16 are not allowed). Note that this restriction doesn't + apply to the built-in support for UTF-8 and UTF-16. + + 4. No Unicode character may be encoded by more than one distinct + sequence of bytes. +*/ +typedef struct { + int map[256]; + void *data; + int (*convert)(void *data, const char *s); + void (*release)(void *data); +} XML_Encoding; + +/* This is called for an encoding that is unknown to the parser. + + The encodingHandlerData argument is that which was passed as the + second argument to XML_SetUnknownEncodingHandler. + + The name argument gives the name of the encoding as specified in + the encoding declaration. + + If the callback can provide information about the encoding, it must + fill in the XML_Encoding structure, and return 1. Otherwise it + must return 0. + + If info does not describe a suitable encoding, then the parser will + return an XML_UNKNOWN_ENCODING error. +*/ +typedef int (*XML_UnknownEncodingHandler)(void *encodingHandlerData, + const XML_Char *name, + XML_Encoding *info); + +XMLPARSEAPI(void) +XML_SetElementHandler(XML_Parser parser, + XML_StartElementHandler start, + XML_EndElementHandler end); + +XMLPARSEAPI(void) +XML_SetStartElementHandler(XML_Parser, XML_StartElementHandler); + +XMLPARSEAPI(void) +XML_SetEndElementHandler(XML_Parser, XML_EndElementHandler); + +XMLPARSEAPI(void) +XML_SetCharacterDataHandler(XML_Parser parser, + XML_CharacterDataHandler handler); + +XMLPARSEAPI(void) +XML_SetProcessingInstructionHandler(XML_Parser parser, + XML_ProcessingInstructionHandler handler); +XMLPARSEAPI(void) +XML_SetCommentHandler(XML_Parser parser, + XML_CommentHandler handler); + +XMLPARSEAPI(void) +XML_SetCdataSectionHandler(XML_Parser parser, + XML_StartCdataSectionHandler start, + XML_EndCdataSectionHandler end); + +XMLPARSEAPI(void) +XML_SetStartCdataSectionHandler(XML_Parser parser, + XML_StartCdataSectionHandler start); + +XMLPARSEAPI(void) +XML_SetEndCdataSectionHandler(XML_Parser parser, + XML_EndCdataSectionHandler end); + +/* This sets the default handler and also inhibits expansion of + internal entities. These entity references will be passed to the + default handler, or to the skipped entity handler, if one is set. +*/ +XMLPARSEAPI(void) +XML_SetDefaultHandler(XML_Parser parser, + XML_DefaultHandler handler); + +/* This sets the default handler but does not inhibit expansion of + internal entities. The entity reference will not be passed to the + default handler. +*/ +XMLPARSEAPI(void) +XML_SetDefaultHandlerExpand(XML_Parser parser, + XML_DefaultHandler handler); + +XMLPARSEAPI(void) +XML_SetDoctypeDeclHandler(XML_Parser parser, + XML_StartDoctypeDeclHandler start, + XML_EndDoctypeDeclHandler end); + +XMLPARSEAPI(void) +XML_SetStartDoctypeDeclHandler(XML_Parser parser, + XML_StartDoctypeDeclHandler start); + +XMLPARSEAPI(void) +XML_SetEndDoctypeDeclHandler(XML_Parser parser, + XML_EndDoctypeDeclHandler end); + +XMLPARSEAPI(void) +XML_SetUnparsedEntityDeclHandler(XML_Parser parser, + XML_UnparsedEntityDeclHandler handler); + +XMLPARSEAPI(void) +XML_SetNotationDeclHandler(XML_Parser parser, + XML_NotationDeclHandler handler); + +XMLPARSEAPI(void) +XML_SetNamespaceDeclHandler(XML_Parser parser, + XML_StartNamespaceDeclHandler start, + XML_EndNamespaceDeclHandler end); + +XMLPARSEAPI(void) +XML_SetStartNamespaceDeclHandler(XML_Parser parser, + XML_StartNamespaceDeclHandler start); + +XMLPARSEAPI(void) +XML_SetEndNamespaceDeclHandler(XML_Parser parser, + XML_EndNamespaceDeclHandler end); + +XMLPARSEAPI(void) +XML_SetNotStandaloneHandler(XML_Parser parser, + XML_NotStandaloneHandler handler); + +XMLPARSEAPI(void) +XML_SetExternalEntityRefHandler(XML_Parser parser, + XML_ExternalEntityRefHandler handler); + +/* If a non-NULL value for arg is specified here, then it will be + passed as the first argument to the external entity ref handler + instead of the parser object. +*/ +XMLPARSEAPI(void) +XML_SetExternalEntityRefHandlerArg(XML_Parser, void *arg); + +XMLPARSEAPI(void) +XML_SetSkippedEntityHandler(XML_Parser parser, + XML_SkippedEntityHandler handler); + +XMLPARSEAPI(void) +XML_SetUnknownEncodingHandler(XML_Parser parser, + XML_UnknownEncodingHandler handler, + void *encodingHandlerData); + +/* This can be called within a handler for a start element, end + element, processing instruction or character data. It causes the + corresponding markup to be passed to the default handler. +*/ +XMLPARSEAPI(void) +XML_DefaultCurrent(XML_Parser parser); + +/* If do_nst is non-zero, and namespace processing is in effect, and + a name has a prefix (i.e. an explicit namespace qualifier) then + that name is returned as a triplet in a single string separated by + the separator character specified when the parser was created: URI + + sep + local_name + sep + prefix. + + If do_nst is zero, then namespace information is returned in the + default manner (URI + sep + local_name) whether or not the name + has a prefix. + + Note: Calling XML_SetReturnNSTriplet after XML_Parse or + XML_ParseBuffer has no effect. +*/ + +XMLPARSEAPI(void) +XML_SetReturnNSTriplet(XML_Parser parser, int do_nst); + +/* This value is passed as the userData argument to callbacks. */ +XMLPARSEAPI(void) +XML_SetUserData(XML_Parser parser, void *userData); + +/* Returns the last value set by XML_SetUserData or NULL. */ +#define XML_GetUserData(parser) (*(void **)(parser)) + +/* This is equivalent to supplying an encoding argument to + XML_ParserCreate. On success XML_SetEncoding returns non-zero, + zero otherwise. + Note: Calling XML_SetEncoding after XML_Parse or XML_ParseBuffer + has no effect and returns zero. +*/ +XMLPARSEAPI(int) +XML_SetEncoding(XML_Parser parser, const XML_Char *encoding); + +/* If this function is called, then the parser will be passed as the + first argument to callbacks instead of userData. The userData will + still be accessible using XML_GetUserData. +*/ +XMLPARSEAPI(void) +XML_UseParserAsHandlerArg(XML_Parser parser); + +/* If useDTD == XML_TRUE is passed to this function, then the parser + will assume that there is an external subset, even if none is + specified in the document. In such a case the parser will call the + externalEntityRefHandler with a value of NULL for the systemId + argument (the publicId and context arguments will be NULL as well). + Note: If this function is called, then this must be done before + the first call to XML_Parse or XML_ParseBuffer, since it will + have no effect after that. Returns + XML_ERROR_CANT_CHANGE_FEATURE_ONCE_PARSING. + Note: If the document does not have a DOCTYPE declaration at all, + then startDoctypeDeclHandler and endDoctypeDeclHandler will not + be called, despite an external subset being parsed. + Note: If XML_DTD is not defined when Expat is compiled, returns + XML_ERROR_FEATURE_REQUIRES_XML_DTD. +*/ +XMLPARSEAPI(enum XML_Error) +XML_UseForeignDTD(XML_Parser parser, XML_Bool useDTD); + + +/* Sets the base to be used for resolving relative URIs in system + identifiers in declarations. Resolving relative identifiers is + left to the application: this value will be passed through as the + base argument to the XML_ExternalEntityRefHandler, + XML_NotationDeclHandler and XML_UnparsedEntityDeclHandler. The base + argument will be copied. Returns zero if out of memory, non-zero + otherwise. +*/ +XMLPARSEAPI(int) +XML_SetBase(XML_Parser parser, const XML_Char *base); + +XMLPARSEAPI(const XML_Char *) +XML_GetBase(XML_Parser parser); + +/* Returns the number of the attribute/value pairs passed in last call + to the XML_StartElementHandler that were specified in the start-tag + rather than defaulted. Each attribute/value pair counts as 2; thus + this correspondds to an index into the atts array passed to the + XML_StartElementHandler. +*/ +XMLPARSEAPI(int) +XML_GetSpecifiedAttributeCount(XML_Parser parser); + +/* Returns the index of the ID attribute passed in the last call to + XML_StartElementHandler, or -1 if there is no ID attribute. Each + attribute/value pair counts as 2; thus this correspondds to an + index into the atts array passed to the XML_StartElementHandler. +*/ +XMLPARSEAPI(int) +XML_GetIdAttributeIndex(XML_Parser parser); + +/* Parses some input. Returns XML_STATUS_ERROR if a fatal error is + detected. The last call to XML_Parse must have isFinal true; len + may be zero for this call (or any other). + + The XML_Status enum gives the possible return values for the + XML_Parse and XML_ParseBuffer functions. Though the return values + for these functions has always been described as a Boolean value, + the implementation, at least for the 1.95.x series, has always + returned exactly one of these values. The preprocessor #defines + are included so this stanza can be added to code that still needs + to support older versions of Expat 1.95.x: + + #ifndef XML_STATUS_OK + #define XML_STATUS_OK 1 + #define XML_STATUS_ERROR 0 + #endif + + Otherwise, the #define hackery is quite ugly and would have been dropped. +*/ +enum XML_Status { + XML_STATUS_ERROR = 0, +#define XML_STATUS_ERROR XML_STATUS_ERROR + XML_STATUS_OK = 1 +#define XML_STATUS_OK XML_STATUS_OK +}; + +XMLPARSEAPI(enum XML_Status) +XML_Parse(XML_Parser parser, const char *s, int len, int isFinal); + +XMLPARSEAPI(void *) +XML_GetBuffer(XML_Parser parser, int len); + +XMLPARSEAPI(enum XML_Status) +XML_ParseBuffer(XML_Parser parser, int len, int isFinal); + +/* Creates an XML_Parser object that can parse an external general + entity; context is a '\0'-terminated string specifying the parse + context; encoding is a '\0'-terminated string giving the name of + the externally specified encoding, or NULL if there is no + externally specified encoding. The context string consists of a + sequence of tokens separated by formfeeds (\f); a token consisting + of a name specifies that the general entity of the name is open; a + token of the form prefix=uri specifies the namespace for a + particular prefix; a token of the form =uri specifies the default + namespace. This can be called at any point after the first call to + an ExternalEntityRefHandler so longer as the parser has not yet + been freed. The new parser is completely independent and may + safely be used in a separate thread. The handlers and userData are + initialized from the parser argument. Returns 0 if out of memory. + Otherwise returns a new XML_Parser object. +*/ +XMLPARSEAPI(XML_Parser) +XML_ExternalEntityParserCreate(XML_Parser parser, + const XML_Char *context, + const XML_Char *encoding); + +enum XML_ParamEntityParsing { + XML_PARAM_ENTITY_PARSING_NEVER, + XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONE, + XML_PARAM_ENTITY_PARSING_ALWAYS +}; + +/* Controls parsing of parameter entities (including the external DTD + subset). If parsing of parameter entities is enabled, then + references to external parameter entities (including the external + DTD subset) will be passed to the handler set with + XML_SetExternalEntityRefHandler. The context passed will be 0. + + Unlike external general entities, external parameter entities can + only be parsed synchronously. If the external parameter entity is + to be parsed, it must be parsed during the call to the external + entity ref handler: the complete sequence of + XML_ExternalEntityParserCreate, XML_Parse/XML_ParseBuffer and + XML_ParserFree calls must be made during this call. After + XML_ExternalEntityParserCreate has been called to create the parser + for the external parameter entity (context must be 0 for this + call), it is illegal to make any calls on the old parser until + XML_ParserFree has been called on the newly created parser. + If the library has been compiled without support for parameter + entity parsing (ie without XML_DTD being defined), then + XML_SetParamEntityParsing will return 0 if parsing of parameter + entities is requested; otherwise it will return non-zero. + Note: If XML_SetParamEntityParsing is called after XML_Parse or + XML_ParseBuffer, then it has no effect and will always return 0. +*/ +XMLPARSEAPI(int) +XML_SetParamEntityParsing(XML_Parser parser, + enum XML_ParamEntityParsing parsing); + +/* If XML_Parse or XML_ParseBuffer have returned 0, then + XML_GetErrorCode returns information about the error. +*/ +XMLPARSEAPI(enum XML_Error) +XML_GetErrorCode(XML_Parser parser); + +/* These functions return information about the current parse + location. They may be called when XML_Parse or XML_ParseBuffer + return 0; in this case the location is the location of the + character at which the error was detected. + + They may also be called from any other callback called to report + some parse event; in this the location is the location of the first + of the sequence of characters that generated the event. +*/ +XMLPARSEAPI(int) XML_GetCurrentLineNumber(XML_Parser parser); +XMLPARSEAPI(int) XML_GetCurrentColumnNumber(XML_Parser parser); +XMLPARSEAPI(long) XML_GetCurrentByteIndex(XML_Parser parser); + +/* Return the number of bytes in the current event. + Returns 0 if the event is in an internal entity. +*/ +XMLPARSEAPI(int) +XML_GetCurrentByteCount(XML_Parser parser); + +/* If XML_CONTEXT_BYTES is defined, returns the input buffer, sets + the integer pointed to by offset to the offset within this buffer + of the current parse position, and sets the integer pointed to by size + to the size of this buffer (the number of input bytes). Otherwise + returns a NULL pointer. Also returns a NULL pointer if a parse isn't + active. + + NOTE: The character pointer returned should not be used outside + the handler that makes the call. +*/ +XMLPARSEAPI(const char *) +XML_GetInputContext(XML_Parser parser, + int *offset, + int *size); + +/* For backwards compatibility with previous versions. */ +#define XML_GetErrorLineNumber XML_GetCurrentLineNumber +#define XML_GetErrorColumnNumber XML_GetCurrentColumnNumber +#define XML_GetErrorByteIndex XML_GetCurrentByteIndex + +/* Frees memory used by the parser. */ +XMLPARSEAPI(void) +XML_ParserFree(XML_Parser parser); + +/* Returns a string describing the error. */ +XMLPARSEAPI(const XML_LChar *) +XML_ErrorString(enum XML_Error code); + +/* Return a string containing the version number of this expat */ +XMLPARSEAPI(const XML_LChar *) +XML_ExpatVersion(void); + +typedef struct { + int major; + int minor; + int micro; +} XML_Expat_Version; + +/* Return an XML_Expat_Version structure containing numeric version + number information for this version of expat. +*/ +XMLPARSEAPI(XML_Expat_Version) +XML_ExpatVersionInfo(void); + +/* Added in Expat 1.95.5. */ +enum XML_FeatureEnum { + XML_FEATURE_END = 0, + XML_FEATURE_UNICODE, + XML_FEATURE_UNICODE_WCHAR_T, + XML_FEATURE_DTD, + XML_FEATURE_CONTEXT_BYTES, + XML_FEATURE_MIN_SIZE, + XML_FEATURE_SIZEOF_XML_CHAR, + XML_FEATURE_SIZEOF_XML_LCHAR + /* Additional features must be added to the end of this enum. */ +}; + +typedef struct { + enum XML_FeatureEnum feature; + XML_LChar *name; + long int value; +} XML_Feature; + +XMLPARSEAPI(const XML_Feature *) +XML_GetFeatureList(void); + + +/* Expat follows the GNU/Linux convention of odd number minor version for + beta/development releases and even number minor version for stable + releases. Micro is bumped with each release, and set to 0 with each + change to major or minor version. +*/ +#define XML_MAJOR_VERSION 1 +#define XML_MINOR_VERSION 95 +#define XML_MICRO_VERSION 5 + +#ifdef __cplusplus +} +#endif + +#endif /* not _BSD_XML_H_ */ diff --git a/src/include.new/bzlib.h b/src/include.new/bzlib.h new file mode 100644 index 0000000..3237243 --- /dev/null +++ b/src/include.new/bzlib.h @@ -0,0 +1,323 @@ + +/*-------------------------------------------------------------*/ +/*--- Public header file for the library. ---*/ +/*--- bzlib.h ---*/ +/*-------------------------------------------------------------*/ + +/*-- + This file is a part of bzip2 and/or libbzip2, a program and + library for lossless, block-sorting data compression. + + Copyright (C) 1996-2005 Julian R Seward. All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + 2. The origin of this software must not be misrepresented; you must + not claim that you wrote the original software. If you use this + software in a product, an acknowledgment in the product + documentation would be appreciated but is not required. + + 3. Altered source versions must be plainly marked as such, and must + not be misrepresented as being the original software. + + 4. The name of the author may not be used to endorse or promote + products derived from this software without specific prior written + permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + Julian Seward, Cambridge, UK. + jseward@bzip.org + bzip2/libbzip2 version 1.0 of 21 March 2000 + + This program is based on (at least) the work of: + Mike Burrows + David Wheeler + Peter Fenwick + Alistair Moffat + Radford Neal + Ian H. Witten + Robert Sedgewick + Jon L. Bentley + + For more information on these sources, see the manual. +--*/ + + +#ifndef _BZLIB_H +#define _BZLIB_H + +#ifdef __cplusplus +extern "C" { +#endif + +#define BZ_RUN 0 +#define BZ_FLUSH 1 +#define BZ_FINISH 2 + +#define BZ_OK 0 +#define BZ_RUN_OK 1 +#define BZ_FLUSH_OK 2 +#define BZ_FINISH_OK 3 +#define BZ_STREAM_END 4 +#define BZ_SEQUENCE_ERROR (-1) +#define BZ_PARAM_ERROR (-2) +#define BZ_MEM_ERROR (-3) +#define BZ_DATA_ERROR (-4) +#define BZ_DATA_ERROR_MAGIC (-5) +#define BZ_IO_ERROR (-6) +#define BZ_UNEXPECTED_EOF (-7) +#define BZ_OUTBUFF_FULL (-8) +#define BZ_CONFIG_ERROR (-9) + +typedef + struct { + char *next_in; + unsigned int avail_in; + unsigned int total_in_lo32; + unsigned int total_in_hi32; + + char *next_out; + unsigned int avail_out; + unsigned int total_out_lo32; + unsigned int total_out_hi32; + + void *state; + + void *(*bzalloc)(void *,int,int); + void (*bzfree)(void *,void *); + void *opaque; + } + bz_stream; + + +#ifndef BZ_IMPORT +#define BZ_EXPORT +#endif + +#ifndef BZ_NO_STDIO +/* Need a definitition for FILE */ +#include +#endif + +#ifdef _WIN32 +# include +# ifdef small + /* windows.h define small to char */ +# undef small +# endif +# ifdef BZ_EXPORT +# define BZ_API(func) WINAPI func +# define BZ_EXTERN extern +# else + /* import windows dll dynamically */ +# define BZ_API(func) (WINAPI * func) +# define BZ_EXTERN +# endif +#else +# define BZ_API(func) func +# define BZ_EXTERN extern +#endif + + +/*-- Core (low-level) library functions --*/ + +BZ_EXTERN int BZ_API(BZ2_bzCompressInit) ( + bz_stream* strm, + int blockSize100k, + int verbosity, + int workFactor + ); + +BZ_EXTERN int BZ_API(BZ2_bzCompress) ( + bz_stream* strm, + int action + ); + +BZ_EXTERN int BZ_API(BZ2_bzCompressEnd) ( + bz_stream* strm + ); + +BZ_EXTERN int BZ_API(BZ2_bzDecompressInit) ( + bz_stream *strm, + int verbosity, + int small + ); + +BZ_EXTERN int BZ_API(BZ2_bzDecompress) ( + bz_stream* strm + ); + +BZ_EXTERN int BZ_API(BZ2_bzDecompressEnd) ( + bz_stream *strm + ); + + + +/*-- High(er) level library functions --*/ + +#ifndef BZ_NO_STDIO +#define BZ_MAX_UNUSED 5000 + +typedef void BZFILE; + +BZ_EXTERN BZFILE* BZ_API(BZ2_bzReadOpen) ( + int* bzerror, + FILE* f, + int verbosity, + int small, + void* unused, + int nUnused + ); + +BZ_EXTERN void BZ_API(BZ2_bzReadClose) ( + int* bzerror, + BZFILE* b + ); + +BZ_EXTERN void BZ_API(BZ2_bzReadGetUnused) ( + int* bzerror, + BZFILE* b, + void** unused, + int* nUnused + ); + +BZ_EXTERN int BZ_API(BZ2_bzRead) ( + int* bzerror, + BZFILE* b, + void* buf, + int len + ); + +BZ_EXTERN BZFILE* BZ_API(BZ2_bzWriteOpen) ( + int* bzerror, + FILE* f, + int blockSize100k, + int verbosity, + int workFactor + ); + +BZ_EXTERN void BZ_API(BZ2_bzWrite) ( + int* bzerror, + BZFILE* b, + void* buf, + int len + ); + +BZ_EXTERN void BZ_API(BZ2_bzWriteClose) ( + int* bzerror, + BZFILE* b, + int abandon, + unsigned int* nbytes_in, + unsigned int* nbytes_out + ); + +BZ_EXTERN void BZ_API(BZ2_bzWriteClose64) ( + int* bzerror, + BZFILE* b, + int abandon, + unsigned int* nbytes_in_lo32, + unsigned int* nbytes_in_hi32, + unsigned int* nbytes_out_lo32, + unsigned int* nbytes_out_hi32 + ); +#endif + + +/*-- Utility functions --*/ + +BZ_EXTERN int BZ_API(BZ2_bzBuffToBuffCompress) ( + char* dest, + unsigned int* destLen, + char* source, + unsigned int sourceLen, + int blockSize100k, + int verbosity, + int workFactor + ); + +BZ_EXTERN int BZ_API(BZ2_bzBuffToBuffDecompress) ( + char* dest, + unsigned int* destLen, + char* source, + unsigned int sourceLen, + int small, + int verbosity + ); + + +/*-- + Code contributed by Yoshioka Tsuneo + (QWF00133@niftyserve.or.jp/tsuneo-y@is.aist-nara.ac.jp), + to support better zlib compatibility. + This code is not _officially_ part of libbzip2 (yet); + I haven't tested it, documented it, or considered the + threading-safeness of it. + If this code breaks, please contact both Yoshioka and me. +--*/ + +BZ_EXTERN const char * BZ_API(BZ2_bzlibVersion) ( + void + ); + +#ifndef BZ_NO_STDIO +BZ_EXTERN BZFILE * BZ_API(BZ2_bzopen) ( + const char *path, + const char *mode + ); + +BZ_EXTERN BZFILE * BZ_API(BZ2_bzdopen) ( + int fd, + const char *mode + ); + +BZ_EXTERN int BZ_API(BZ2_bzread) ( + BZFILE* b, + void* buf, + int len + ); + +BZ_EXTERN int BZ_API(BZ2_bzwrite) ( + BZFILE* b, + void* buf, + int len + ); + +BZ_EXTERN int BZ_API(BZ2_bzflush) ( + BZFILE* b + ); + +BZ_EXTERN void BZ_API(BZ2_bzclose) ( + BZFILE* b + ); + +BZ_EXTERN const char * BZ_API(BZ2_bzerror) ( + BZFILE *b, + int *errnum + ); +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +/*-------------------------------------------------------------*/ +/*--- end bzlib.h ---*/ +/*-------------------------------------------------------------*/ diff --git a/src/include.new/calendar.h b/src/include.new/calendar.h new file mode 100644 index 0000000..378382a --- /dev/null +++ b/src/include.new/calendar.h @@ -0,0 +1,42 @@ +/*- + * Copyright (c) 1997 Wolfgang Helbig + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD: src/lib/libcalendar/calendar.h,v 1.4 1999/08/28 00:04:04 peter Exp $ + */ +struct date { + int y; /* year */ + int m; /* month */ + int d; /* day */ +}; + +struct date *easterg(int _year, struct date *_dt); +struct date *easterog(int _year, struct date *_dt); +struct date *easteroj(int _year, struct date *_dt); +struct date *gdate(int _nd, struct date *_dt); +struct date *jdate(int _nd, struct date *_dt); +int ndaysg(struct date *_dt); +int ndaysj(struct date *_dt); +int week(int _nd, int *_year); +int weekday(int _nd); diff --git a/src/include.new/camlib.h b/src/include.new/camlib.h new file mode 100644 index 0000000..a0d1817 --- /dev/null +++ b/src/include.new/camlib.h @@ -0,0 +1,181 @@ +/* + * Copyright (c) 1997, 1998 Kenneth D. Merry. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD: src/lib/libcam/camlib.h,v 1.5 2002/04/23 23:58:20 obrien Exp $ + */ +/* + * Buffer encoding/decoding routines taken from the original FreeBSD SCSI + * library and slightly modified. The original header file had the following + * copyright: + */ +/* Copyright (c) 1994 HD Associates (hd@world.std.com) + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by HD Associates + * 4. Neither the name of the HD Associaates nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY HD ASSOCIATES``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL HD ASSOCIATES OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + + +#ifndef _CAMLIB_H +#define _CAMLIB_H + +#include +#include + +#include +#include + +#define CAM_ERRBUF_SIZE 2048 /* sizeof the CAM libarary error string */ + +/* + * Right now we hard code the transport layer device, but this will change + * if we ever get more than one transport layer. + */ +#define XPT_DEVICE "/dev/xpt0" + + +extern char cam_errbuf[]; + +struct cam_device { + char device_path[MAXPATHLEN];/* + * Pathname of the device + * given by the user. This + * may be null if the + * user states the device + * name and unit number + * separately. + */ + char given_dev_name[DEV_IDLEN+1];/* + * Device name given by + * the user. + */ + u_int32_t given_unit_number; /* + * Unit number given by + * the user. + */ + char device_name[DEV_IDLEN+1];/* + * Name of the device, + * e.g. 'pass' + */ + u_int32_t dev_unit_num; /* Unit number of the passthrough + * device associated with this + * particular device. + */ + + char sim_name[SIM_IDLEN+1]; /* Controller name, e.g. 'ahc' */ + u_int32_t sim_unit_number; /* Controller unit number */ + u_int32_t bus_id; /* Controller bus number */ + lun_id_t target_lun; /* Logical Unit Number */ + target_id_t target_id; /* Target ID */ + path_id_t path_id; /* System SCSI bus number */ + u_int16_t pd_type; /* type of peripheral device */ + struct scsi_inquiry_data inq_data; /* SCSI Inquiry data */ + u_int8_t serial_num[252]; /* device serial number */ + u_int8_t serial_num_len; /* length of the serial number */ + u_int8_t sync_period; /* Negotiated sync period */ + u_int8_t sync_offset; /* Negotiated sync offset */ + u_int8_t bus_width; /* Negotiated bus width */ + int fd; /* file descriptor for device */ +}; + +__BEGIN_DECLS +/* Basic utility commands */ +struct cam_device * cam_open_device(const char *path, int flags); +void cam_close_device(struct cam_device *dev); +void cam_close_spec_device(struct cam_device *dev); +struct cam_device * cam_open_spec_device(const char *dev_name, + int unit, int flags, + struct cam_device *device); +struct cam_device * cam_open_btl(path_id_t path_id, target_id_t target_id, + lun_id_t target_lun, int flags, + struct cam_device *device); +struct cam_device * cam_open_pass(const char *path, int flags, + struct cam_device *device); +union ccb * cam_getccb(struct cam_device *dev); +void cam_freeccb(union ccb *ccb); +int cam_send_ccb(struct cam_device *device, union ccb *ccb); +char * cam_path_string(struct cam_device *dev, char *str, + int len); +struct cam_device * cam_device_dup(struct cam_device *device); +void cam_device_copy(struct cam_device *src, + struct cam_device *dst); +int cam_get_device(const char *path, char *dev_name, + int devnamelen, int *unit); + +/* + * Buffer encoding/decoding routines, from the old SCSI library. + */ +int csio_decode(struct ccb_scsiio *csio, const char *fmt, ...) + __printflike(2, 3); +int csio_decode_visit(struct ccb_scsiio *csio, const char *fmt, + void (*arg_put)(void *, int, void *, int, char *), + void *puthook); +int buff_decode(u_int8_t *buff, size_t len, const char *fmt, ...) + __printflike(3, 4); +int buff_decode_visit(u_int8_t *buff, size_t len, const char *fmt, + void (*arg_put)(void *, int, void *, int, char *), + void *puthook); +int csio_build(struct ccb_scsiio *csio, u_int8_t *data_ptr, + u_int32_t dxfer_len, u_int32_t flags, int retry_count, + int timeout, const char *cmd_spec, ...); +int csio_build_visit(struct ccb_scsiio *csio, u_int8_t *data_ptr, + u_int32_t dxfer_len, u_int32_t flags, int retry_count, + int timeout, const char *cmd_spec, + int (*arg_get)(void *hook, char *field_name), + void *gethook); +int csio_encode(struct ccb_scsiio *csio, const char *fmt, ...) + __printflike(2, 3); +int buff_encode_visit(u_int8_t *buff, size_t len, const char *fmt, + int (*arg_get)(void *hook, char *field_name), + void *gethook); +int csio_encode_visit(struct ccb_scsiio *csio, const char *fmt, + int (*arg_get)(void *hook, char *field_name), + void *gethook); +__END_DECLS + +#endif /* _CAMLIB_H */ diff --git a/src/include.new/com_err.h b/src/include.new/com_err.h new file mode 100644 index 0000000..8979ffc --- /dev/null +++ b/src/include.new/com_err.h @@ -0,0 +1,65 @@ +/* + * Copyright (c) 1997 - 2001 Kungliga Tekniska H�gskolan + * (Royal Institute of Technology, Stockholm, Sweden). + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of the Institute nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* $FreeBSD: src/contrib/com_err/com_err.h,v 1.3 2004/04/03 21:17:01 nectar Exp $ */ +/* $Id$ */ + +/* MIT compatible com_err library */ + +#ifndef __COM_ERR_H__ +#define __COM_ERR_H__ + +#include +#include + +#include + +typedef void (*errf) __P((const char *, long, const char *, va_list)); + +const char * error_message __P((long)); +int init_error_table __P((const char**, long, int)); + +void com_err_va __P((const char *, long, const char *, va_list)) + __printflike(3, 0); + +void com_err __P((const char *, long, const char *, ...)) + __printflike(3, 4); + +errf set_com_err_hook __P((errf)); +errf reset_com_err_hook __P((void)); + +const char *error_table_name __P((int num)); + +void add_to_error_table __P((struct et_list *new_table)); + +#endif /* __COM_ERR_H__ */ diff --git a/src/include.new/com_right.h b/src/include.new/com_right.h new file mode 100644 index 0000000..8d453bd --- /dev/null +++ b/src/include.new/com_right.h @@ -0,0 +1,58 @@ +/* + * Copyright (c) 1997 - 2000 Kungliga Tekniska H�gskolan + * (Royal Institute of Technology, Stockholm, Sweden). + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of the Institute nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* $Id$ */ +/* $FreeBSD: src/contrib/com_err/com_right.h,v 1.3 2004/04/03 21:17:01 nectar Exp $ */ + +#ifndef __COM_RIGHT_H__ +#define __COM_RIGHT_H__ + +#include +#include + +struct error_table { + char const * const * msgs; + long base; + int n_msgs; +}; +struct et_list { + struct et_list *next; + struct error_table *table; +}; +extern struct et_list *_et_list; + +const char *com_right __P((struct et_list *list, long code)); +void initialize_error_table_r __P((struct et_list **, const char **, int, long)); +void free_error_table __P((struct et_list *)); + +#endif /* __COM_RIGHT_H__ */ diff --git a/src/include.new/complex.h b/src/include.new/complex.h new file mode 100644 index 0000000..51d9a7f --- /dev/null +++ b/src/include.new/complex.h @@ -0,0 +1,61 @@ +/*- + * Copyright (c) 2001 The FreeBSD Project. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD: src/include/complex.h,v 1.6 2004/08/14 18:03:21 stefanf Exp $ + */ + +#ifndef _COMPLEX_H +#define _COMPLEX_H + +#ifdef __GNUC__ +#if __STDC_VERSION__ < 199901 +#define _Complex __complex__ +#endif +#define _Complex_I 1.0fi +#endif + +#define complex _Complex +#define I _Complex_I + +#include + +__BEGIN_DECLS + +double cabs(double complex); +float cabsf(float complex); +double cimag(double complex); +float cimagf(float complex); +long double cimagl(long double complex); +double complex conj(double complex); +float complex conjf(float complex); +long double complex + conjl(long double complex); +double creal(double complex); +float crealf(float complex); +long double creall(long double complex); + +__END_DECLS + +#endif /* _COMPLEX_H */ diff --git a/src/include.new/cpio.h b/src/include.new/cpio.h new file mode 100644 index 0000000..d287af6 --- /dev/null +++ b/src/include.new/cpio.h @@ -0,0 +1,55 @@ +/*- + * Copyright (c) 2002 Mike Barcroft + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD: src/include/cpio.h,v 1.1 2002/08/01 07:18:38 mike Exp $ + */ + +#ifndef _CPIO_H_ +#define _CPIO_H_ + +#define C_ISSOCK 0140000 /* Socket. */ +#define C_ISLNK 0120000 /* Symbolic link. */ +#define C_ISCTG 0110000 /* Reserved. */ +#define C_ISREG 0100000 /* Regular file. */ +#define C_ISBLK 0060000 /* Block special. */ +#define C_ISDIR 0040000 /* Directory. */ +#define C_ISCHR 0020000 /* Character special. */ +#define C_ISFIFO 0010000 /* FIFO. */ +#define C_ISUID 0004000 /* Set user ID. */ +#define C_ISGID 0002000 /* Set group ID. */ +#define C_ISVTX 0001000 /* On directories, restricted deletion flag. */ +#define C_IRUSR 0000400 /* Read by owner. */ +#define C_IWUSR 0000200 /* Write by owner. */ +#define C_IXUSR 0000100 /* Execute by owner. */ +#define C_IRGRP 0000040 /* Read by group. */ +#define C_IWGRP 0000020 /* Write by group. */ +#define C_IXGRP 0000010 /* Execute by group. */ +#define C_IROTH 0000004 /* Read by others. */ +#define C_IWOTH 0000002 /* Write by others. */ +#define C_IXOTH 0000001 /* Execute by others. */ + +#define MAGIC "070707" + +#endif /* _CPIO_H_ */ diff --git a/src/include.new/ctype.h b/src/include.new/ctype.h new file mode 100644 index 0000000..4368a9b --- /dev/null +++ b/src/include.new/ctype.h @@ -0,0 +1,135 @@ +/* + * Copyright (c) 1989, 1993 + * The Regents of the University of California. All rights reserved. + * (c) UNIX System Laboratories, Inc. + * All or some portions of this file are derived from material licensed + * to the University of California by American Telephone and Telegraph + * Co. or Unix System Laboratories, Inc. and are reproduced herein with + * the permission of UNIX System Laboratories, Inc. + * + * This code is derived from software contributed to Berkeley by + * Paul Borman at Krystal Technologies. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)ctype.h 8.4 (Berkeley) 1/21/94 + * $FreeBSD: src/include/ctype.h,v 1.28 2004/08/12 09:33:47 tjr Exp $ + */ + +#ifndef _CTYPE_H_ +#define _CTYPE_H_ + +#include +#include +#include <_ctype.h> + +__BEGIN_DECLS +int isalnum(int); +int isalpha(int); +int iscntrl(int); +int isdigit(int); +int isgraph(int); +int islower(int); +int isprint(int); +int ispunct(int); +int isspace(int); +int isupper(int); +int isxdigit(int); +int tolower(int); +int toupper(int); + +#if __XSI_VISIBLE +int _tolower(int); +int _toupper(int); +int isascii(int); +int toascii(int); +#endif + +#if __ISO_C_VISIBLE >= 1999 +int isblank(int); +#endif + +#if __BSD_VISIBLE +int digittoint(int); +int ishexnumber(int); +int isideogram(int); +int isnumber(int); +int isphonogram(int); +int isrune(int); +int isspecial(int); +#endif +__END_DECLS + +#define isalnum(c) __istype((c), _CTYPE_A|_CTYPE_D) +#define isalpha(c) __istype((c), _CTYPE_A) +#define iscntrl(c) __istype((c), _CTYPE_C) +#define isdigit(c) __isctype((c), _CTYPE_D) /* ANSI -- locale independent */ +#define isgraph(c) __istype((c), _CTYPE_G) +#define islower(c) __istype((c), _CTYPE_L) +#define isprint(c) __istype((c), _CTYPE_R) +#define ispunct(c) __istype((c), _CTYPE_P) +#define isspace(c) __istype((c), _CTYPE_S) +#define isupper(c) __istype((c), _CTYPE_U) +#define isxdigit(c) __isctype((c), _CTYPE_X) /* ANSI -- locale independent */ +#define tolower(c) __tolower(c) +#define toupper(c) __toupper(c) + +#if __XSI_VISIBLE +/* + * POSIX.1-2001 specifies _tolower() and _toupper() to be macros equivalent to + * tolower() and toupper() respectively, minus extra checking to ensure that + * the argument is a lower or uppercase letter respectively. We've chosen to + * implement these macros with the same error checking as tolower() and + * toupper() since this doesn't violate the specification itself, only its + * intent. We purposely leave _tolower() and _toupper() undocumented to + * discourage their use. + * + * XXX isascii() and toascii() should similarly be undocumented. + */ +#define _tolower(c) __tolower(c) +#define _toupper(c) __toupper(c) +#define isascii(c) (((c) & ~0x7F) == 0) +#define toascii(c) ((c) & 0x7F) +#endif + +#if __ISO_C_VISIBLE >= 1999 +#define isblank(c) __istype((c), _CTYPE_B) +#endif + +#if __BSD_VISIBLE +#define digittoint(c) __maskrune((c), 0xFF) +#define ishexnumber(c) __istype((c), _CTYPE_X) +#define isideogram(c) __istype((c), _CTYPE_I) +#define isnumber(c) __istype((c), _CTYPE_D) +#define isphonogram(c) __istype((c), _CTYPE_Q) +#define isrune(c) __istype((c), 0xFFFFFF00L) +#define isspecial(c) __istype((c), _CTYPE_T) +#endif + +#endif /* !_CTYPE_H_ */ diff --git a/src/include.new/curses.h b/src/include.new/curses.h new file mode 100644 index 0000000..059fc5f --- /dev/null +++ b/src/include.new/curses.h @@ -0,0 +1,1194 @@ +/**************************************************************************** + * Copyright (c) 1998-2001,2002 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + * and: Thomas E. Dickey 1996-on * + ****************************************************************************/ + +/* $Id$ */ + +#ifndef __NCURSES_H +#define __NCURSES_H + +#define CURSES 1 +#define CURSES_H 1 + +/* This should be defined for the enhanced functionality to be visible. + * However, none of the wide-character (enhanced) functionality is implemented. + * So we do not define it (yet). +#define _XOPEN_CURSES 1 + */ + +/* These are defined only in curses.h, and are used for conditional compiles */ +#define NCURSES_VERSION_MAJOR 5 +#define NCURSES_VERSION_MINOR 2 +#define NCURSES_VERSION_PATCH 20020615 + +/* This is defined in more than one ncurses header, for identification */ +#undef NCURSES_VERSION +#define NCURSES_VERSION "5.2" + +#include + +#ifdef NCURSES_NOMACROS +#define NCURSES_ATTR_T attr_t +#endif + +#ifndef NCURSES_ATTR_T +#define NCURSES_ATTR_T int +#endif + +#undef NCURSES_CONST +#define NCURSES_CONST const + +#undef NCURSES_COLOR_T +#define NCURSES_COLOR_T short + +#undef NCURSES_SIZE_T +#define NCURSES_SIZE_T short + +#undef NCURSES_CH_T +#define NCURSES_CH_T chtype + +typedef unsigned long chtype; + +#include +#include +#include /* we need va_list */ +#ifdef _XOPEN_SOURCE_EXTENDED +#include /* we want wchar_t */ +#endif /* _XOPEN_SOURCE_EXTENDED */ + +/* XSI and SVr4 specify that curses implements 'bool'. However, C++ may also + * implement it. If so, we must use the C++ compiler's type to avoid conflict + * with other interfaces. + * + * A further complication is that may declare 'bool' to be a + * different type, such as an enum which is not necessarily compatible with + * C++. If we have , make 'bool' a macro, so users may #undef it. + * Otherwise, let it remain a typedef to avoid conflicts with other #define's. + * In either case, make a typedef for NCURSES_BOOL which can be used if needed + * from either C or C++. + */ + +#undef TRUE +#define TRUE 1 + +#undef FALSE +#define FALSE 0 + +typedef unsigned char NCURSES_BOOL; + +#if (!defined(__cplusplus) || !1) && (!0) + +#if 1 +#include +#endif + +#undef bool + +#if 1 +#define bool NCURSES_BOOL +#else +typedef unsigned char bool; +#endif + +#endif /* !__cplusplus, etc. */ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * XSI attributes. In the ncurses implementation, they are identical to the + * A_ attributes. + */ +#define WA_ATTRIBUTES A_ATTRIBUTES +#define WA_NORMAL A_NORMAL +#define WA_STANDOUT A_STANDOUT +#define WA_UNDERLINE A_UNDERLINE +#define WA_REVERSE A_REVERSE +#define WA_BLINK A_BLINK +#define WA_DIM A_DIM +#define WA_BOLD A_BOLD +#define WA_ALTCHARSET A_ALTCHARSET +#define WA_INVIS A_INVIS +#define WA_PROTECT A_PROTECT +#define WA_HORIZONTAL A_HORIZONTAL +#define WA_LEFT A_LEFT +#define WA_LOW A_LOW +#define WA_RIGHT A_RIGHT +#define WA_TOP A_TOP +#define WA_VERTICAL A_VERTICAL + +/* colors */ +extern NCURSES_EXPORT_VAR(int) COLORS; +extern NCURSES_EXPORT_VAR(int) COLOR_PAIRS; + +#define COLOR_BLACK 0 +#define COLOR_RED 1 +#define COLOR_GREEN 2 +#define COLOR_YELLOW 3 +#define COLOR_BLUE 4 +#define COLOR_MAGENTA 5 +#define COLOR_CYAN 6 +#define COLOR_WHITE 7 + +/* line graphics */ + +#if 0 +extern NCURSES_EXPORT_VAR(chtype*) _nc_acs_map(void); +#define acs_map (_nc_acs_map()) +#else +extern NCURSES_EXPORT_VAR(chtype) acs_map[]; +#endif + +/* VT100 symbols begin here */ +#define ACS_ULCORNER (acs_map['l']) /* upper left corner */ +#define ACS_LLCORNER (acs_map['m']) /* lower left corner */ +#define ACS_URCORNER (acs_map['k']) /* upper right corner */ +#define ACS_LRCORNER (acs_map['j']) /* lower right corner */ +#define ACS_LTEE (acs_map['t']) /* tee pointing right */ +#define ACS_RTEE (acs_map['u']) /* tee pointing left */ +#define ACS_BTEE (acs_map['v']) /* tee pointing up */ +#define ACS_TTEE (acs_map['w']) /* tee pointing down */ +#define ACS_HLINE (acs_map['q']) /* horizontal line */ +#define ACS_VLINE (acs_map['x']) /* vertical line */ +#define ACS_PLUS (acs_map['n']) /* large plus or crossover */ +#define ACS_S1 (acs_map['o']) /* scan line 1 */ +#define ACS_S9 (acs_map['s']) /* scan line 9 */ +#define ACS_DIAMOND (acs_map['`']) /* diamond */ +#define ACS_CKBOARD (acs_map['a']) /* checker board (stipple) */ +#define ACS_DEGREE (acs_map['f']) /* degree symbol */ +#define ACS_PLMINUS (acs_map['g']) /* plus/minus */ +#define ACS_BULLET (acs_map['~']) /* bullet */ +/* Teletype 5410v1 symbols begin here */ +#define ACS_LARROW (acs_map[',']) /* arrow pointing left */ +#define ACS_RARROW (acs_map['+']) /* arrow pointing right */ +#define ACS_DARROW (acs_map['.']) /* arrow pointing down */ +#define ACS_UARROW (acs_map['-']) /* arrow pointing up */ +#define ACS_BOARD (acs_map['h']) /* board of squares */ +#define ACS_LANTERN (acs_map['i']) /* lantern symbol */ +#define ACS_BLOCK (acs_map['0']) /* solid square block */ +/* + * These aren't documented, but a lot of System Vs have them anyway + * (you can spot pprryyzz{{||}} in a lot of AT&T terminfo strings). + * The ACS_names may not match AT&T's, our source didn't know them. + */ +#define ACS_S3 (acs_map['p']) /* scan line 3 */ +#define ACS_S7 (acs_map['r']) /* scan line 7 */ +#define ACS_LEQUAL (acs_map['y']) /* less/equal */ +#define ACS_GEQUAL (acs_map['z']) /* greater/equal */ +#define ACS_PI (acs_map['{']) /* Pi */ +#define ACS_NEQUAL (acs_map['|']) /* not equal */ +#define ACS_STERLING (acs_map['}']) /* UK pound sign */ + +/* + * Line drawing ACS names are of the form ACS_trbl, where t is the top, r + * is the right, b is the bottom, and l is the left. t, r, b, and l might + * be B (blank), S (single), D (double), or T (thick). The subset defined + * here only uses B and S. + */ +#define ACS_BSSB ACS_ULCORNER +#define ACS_SSBB ACS_LLCORNER +#define ACS_BBSS ACS_URCORNER +#define ACS_SBBS ACS_LRCORNER +#define ACS_SBSS ACS_RTEE +#define ACS_SSSB ACS_LTEE +#define ACS_SSBS ACS_BTEE +#define ACS_BSSS ACS_TTEE +#define ACS_BSBS ACS_HLINE +#define ACS_SBSB ACS_VLINE +#define ACS_SSSS ACS_PLUS + +#if defined(ERR) && ((ERR) != -1) +#undef ERR +#endif + +#if !defined(ERR) +#define ERR (-1) +#endif + +#if defined(OK) && ((OK) != 0) +#undef OK +#endif + +#if !defined(OK) +#define OK (0) +#endif + +/* values for the _flags member */ +#define _SUBWIN 0x01 /* is this a sub-window? */ +#define _ENDLINE 0x02 /* is the window flush right? */ +#define _FULLWIN 0x04 /* is the window full-screen? */ +#define _SCROLLWIN 0x08 /* bottom edge is at screen bottom? */ +#define _ISPAD 0x10 /* is this window a pad? */ +#define _HASMOVED 0x20 /* has cursor moved since last refresh? */ +#define _WRAPPED 0x40 /* cursor was just wrappped */ + +/* + * this value is used in the firstchar and lastchar fields to mark + * unchanged lines + */ +#define _NOCHANGE -1 + +/* + * this value is used in the oldindex field to mark lines created by insertions + * and scrolls. + */ +#define _NEWINDEX -1 + +typedef struct screen SCREEN; +typedef struct _win_st WINDOW; + +typedef chtype attr_t; /* ...must be at least as wide as chtype */ + +#ifdef _XOPEN_SOURCE_EXTENDED + +#if 0 +#ifdef mblen /* libutf8.h defines it w/o undefining first */ +#undef mblen +#endif +#include +#define __wchar_t +#define __wint_t +#endif + +#if 0 +#include /* ...to get mbstate_t, etc. */ +#endif + +#ifndef __wchar_t +typedef unsigned long wchar_t; +#endif /* __wchar_t */ +#ifndef __wint_t +typedef long int wint_t; +#endif /* __wint_t */ + +#define CCHARW_MAX 5 +typedef struct +{ + attr_t attr; + wchar_t chars[CCHARW_MAX]; +} +cchar_t; + +#endif /* _XOPEN_SOURCE_EXTENDED */ + +struct ldat; + +struct _win_st +{ + NCURSES_SIZE_T _cury, _curx; /* current cursor position */ + + /* window location and size */ + NCURSES_SIZE_T _maxy, _maxx; /* maximums of x and y, NOT window size */ + NCURSES_SIZE_T _begy, _begx; /* screen coords of upper-left-hand corner */ + + short _flags; /* window state flags */ + + /* attribute tracking */ + attr_t _attrs; /* current attribute for non-space character */ + chtype _bkgd; /* current background char/attribute pair */ + + /* option values set by user */ + bool _notimeout; /* no time out on function-key entry? */ + bool _clear; /* consider all data in the window invalid? */ + bool _leaveok; /* OK to not reset cursor on exit? */ + bool _scroll; /* OK to scroll this window? */ + bool _idlok; /* OK to use insert/delete line? */ + bool _idcok; /* OK to use insert/delete char? */ + bool _immed; /* window in immed mode? (not yet used) */ + bool _sync; /* window in sync mode? */ + bool _use_keypad; /* process function keys into KEY_ symbols? */ + int _delay; /* 0 = nodelay, <0 = blocking, >0 = delay */ + + struct ldat *_line; /* the actual line data */ + + /* global screen state */ + NCURSES_SIZE_T _regtop; /* top line of scrolling region */ + NCURSES_SIZE_T _regbottom; /* bottom line of scrolling region */ + + /* these are used only if this is a sub-window */ + int _parx; /* x coordinate of this window in parent */ + int _pary; /* y coordinate of this window in parent */ + WINDOW *_parent; /* pointer to parent if a sub-window */ + + /* these are used only if this is a pad */ + struct pdat + { + NCURSES_SIZE_T _pad_y, _pad_x; + NCURSES_SIZE_T _pad_top, _pad_left; + NCURSES_SIZE_T _pad_bottom, _pad_right; + } _pad; + + NCURSES_SIZE_T _yoffset; /* real begy is _begy + _yoffset */ + +#ifdef _XOPEN_SOURCE_EXTENDED + cchar_t _bkgrnd; /* current background char/attribute pair */ +#endif +}; + +extern NCURSES_EXPORT_VAR(WINDOW *) stdscr; +extern NCURSES_EXPORT_VAR(WINDOW *) curscr; +extern NCURSES_EXPORT_VAR(WINDOW *) newscr; + +extern NCURSES_EXPORT_VAR(int) LINES; +extern NCURSES_EXPORT_VAR(int) COLS; +extern NCURSES_EXPORT_VAR(int) TABSIZE; + +/* + * This global was an undocumented feature under AIX curses. + */ +extern NCURSES_EXPORT_VAR(int) ESCDELAY; /* ESC expire time in milliseconds */ + +extern NCURSES_EXPORT_VAR(char) ttytype[]; /* needed for backward compatibility */ + +/* + * These functions are extensions - not in XSI Curses. + */ +#if 1 +extern NCURSES_EXPORT(bool) is_term_resized (int, int); +extern NCURSES_EXPORT(char *) keybound (int, int); +extern NCURSES_EXPORT(const char *) curses_version (void); +extern NCURSES_EXPORT(int) assume_default_colors (int, int); +extern NCURSES_EXPORT(int) define_key (char *, int); +extern NCURSES_EXPORT(int) keyok (int, bool); +extern NCURSES_EXPORT(int) resize_term (int, int); +extern NCURSES_EXPORT(int) resizeterm (int, int); +extern NCURSES_EXPORT(int) use_default_colors (void); +extern NCURSES_EXPORT(int) use_extended_names (bool); +extern NCURSES_EXPORT(int) wresize (WINDOW *, int, int); +#else +#define curses_version() NCURSES_VERSION +#endif + +/* + * GCC (and some other compilers) define '__attribute__'; we're using this + * macro to alert the compiler to flag inconsistencies in printf/scanf-like + * function calls. Just in case '__attribute__' isn't defined, make a dummy. + * G++ doesn't accept it anyway. + */ +#if !defined(__GNUC__) && !defined(__attribute__) +#define __attribute__(p) /* nothing */ +#endif + +/* + * For g++, turn off our macros that use __attribute__ (g++ recognizes some + * of them, but not at the same version levels as gcc). + */ +#ifdef __cplusplus +#undef GCC_NORETURN +#undef GCC_PRINTF +#undef GCC_SCANF +#undef GCC_UNUSED +#endif + +/* + * We cannot define these in ncurses_cfg.h, since they require parameters to be + * passed (that's non-portable). + */ +#ifndef GCC_PRINTFLIKE +#if defined(GCC_PRINTF) && !defined(printf) +#define GCC_PRINTFLIKE(fmt,var) __attribute__((format(printf,fmt,var))) +#else +#define GCC_PRINTFLIKE(fmt,var) /*nothing*/ +#endif +#endif + +#ifndef GCC_SCANFLIKE +#if defined(GCC_SCANF) && !defined(scanf) +#define GCC_SCANFLIKE(fmt,var) __attribute__((format(scanf,fmt,var))) +#else +#define GCC_SCANFLIKE(fmt,var) /*nothing*/ +#endif +#endif + +#ifndef GCC_NORETURN +#define GCC_NORETURN /* nothing */ +#endif + +#ifndef GCC_UNUSED +#define GCC_UNUSED /* nothing */ +#endif + +/* + * Function prototypes. This is the complete XSI Curses list of required + * functions. Those marked `generated' will have sources generated from the + * macro definitions later in this file, in order to satisfy XPG4.2 + * requirements. + */ + +extern NCURSES_EXPORT(int) addch (const chtype); /* generated */ +extern NCURSES_EXPORT(int) addchnstr (const chtype *, int); /* generated */ +extern NCURSES_EXPORT(int) addchstr (const chtype *); /* generated */ +extern NCURSES_EXPORT(int) addnstr (const char *, int); /* generated */ +extern NCURSES_EXPORT(int) addstr (const char *); /* generated */ +extern NCURSES_EXPORT(int) attroff (NCURSES_ATTR_T); /* generated */ +extern NCURSES_EXPORT(int) attron (NCURSES_ATTR_T); /* generated */ +extern NCURSES_EXPORT(int) attrset (NCURSES_ATTR_T); /* generated */ +extern NCURSES_EXPORT(int) attr_get (attr_t *, short *, void *); /* generated */ +extern NCURSES_EXPORT(int) attr_off (attr_t, void *); /* generated */ +extern NCURSES_EXPORT(int) attr_on (attr_t, void *); /* generated */ +extern NCURSES_EXPORT(int) attr_set (attr_t, short, void *); /* generated */ +extern NCURSES_EXPORT(int) baudrate (void); /* implemented */ +extern NCURSES_EXPORT(int) beep (void); /* implemented */ +extern NCURSES_EXPORT(int) bkgd (chtype); /* generated */ +extern NCURSES_EXPORT(void) bkgdset (chtype); /* generated */ +extern NCURSES_EXPORT(int) border (chtype,chtype,chtype,chtype,chtype,chtype,chtype,chtype); /* generated */ +extern NCURSES_EXPORT(int) box (WINDOW *, chtype, chtype); /* generated */ +extern NCURSES_EXPORT(bool) can_change_color (void); /* implemented */ +extern NCURSES_EXPORT(int) cbreak (void); /* implemented */ +extern NCURSES_EXPORT(int) chgat (int, attr_t, short, const void *); /* generated */ +extern NCURSES_EXPORT(int) clear (void); /* generated */ +extern NCURSES_EXPORT(int) clearok (WINDOW *,bool); /* implemented */ +extern NCURSES_EXPORT(int) clrtobot (void); /* generated */ +extern NCURSES_EXPORT(int) clrtoeol (void); /* generated */ +extern NCURSES_EXPORT(int) color_content (short,short*,short*,short*); /* implemented */ +extern NCURSES_EXPORT(int) color_set (short,void*); /* generated */ +extern NCURSES_EXPORT(int) COLOR_PAIR (int); /* generated */ +extern NCURSES_EXPORT(int) copywin (const WINDOW*,WINDOW*,int,int,int,int,int,int,int); /* implemented */ +extern NCURSES_EXPORT(int) curs_set (int); /* implemented */ +extern NCURSES_EXPORT(int) def_prog_mode (void); /* implemented */ +extern NCURSES_EXPORT(int) def_shell_mode (void); /* implemented */ +extern NCURSES_EXPORT(int) delay_output (int); /* implemented */ +extern NCURSES_EXPORT(int) delch (void); /* generated */ +extern NCURSES_EXPORT(void) delscreen (SCREEN *); /* implemented */ +extern NCURSES_EXPORT(int) delwin (WINDOW *); /* implemented */ +extern NCURSES_EXPORT(int) deleteln (void); /* generated */ +extern NCURSES_EXPORT(WINDOW *) derwin (WINDOW *,int,int,int,int); /* implemented */ +extern NCURSES_EXPORT(int) doupdate (void); /* implemented */ +extern NCURSES_EXPORT(WINDOW *) dupwin (WINDOW *); /* implemented */ +extern NCURSES_EXPORT(int) echo (void); /* implemented */ +extern NCURSES_EXPORT(int) echochar (const chtype); /* generated */ +extern NCURSES_EXPORT(int) erase (void); /* generated */ +extern NCURSES_EXPORT(int) endwin (void); /* implemented */ +extern NCURSES_EXPORT(char) erasechar (void); /* implemented */ +extern NCURSES_EXPORT(void) filter (void); /* implemented */ +extern NCURSES_EXPORT(int) flash (void); /* implemented */ +extern NCURSES_EXPORT(int) flushinp (void); /* implemented */ +extern NCURSES_EXPORT(chtype) getbkgd (WINDOW *); /* generated */ +extern NCURSES_EXPORT(int) getch (void); /* generated */ +extern NCURSES_EXPORT(int) getnstr (char *, int); /* generated */ +extern NCURSES_EXPORT(int) getstr (char *); /* generated */ +extern NCURSES_EXPORT(WINDOW *) getwin (FILE *); /* implemented */ +extern NCURSES_EXPORT(int) halfdelay (int); /* implemented */ +extern NCURSES_EXPORT(bool) has_colors (void); /* implemented */ +extern NCURSES_EXPORT(bool) has_ic (void); /* implemented */ +extern NCURSES_EXPORT(bool) has_il (void); /* implemented */ +extern NCURSES_EXPORT(int) hline (chtype, int); /* generated */ +extern NCURSES_EXPORT(void) idcok (WINDOW *, bool); /* implemented */ +extern NCURSES_EXPORT(int) idlok (WINDOW *, bool); /* implemented */ +extern NCURSES_EXPORT(void) immedok (WINDOW *, bool); /* implemented */ +extern NCURSES_EXPORT(chtype) inch (void); /* generated */ +extern NCURSES_EXPORT(int) inchnstr (chtype *, int); /* generated */ +extern NCURSES_EXPORT(int) inchstr (chtype *); /* generated */ +extern NCURSES_EXPORT(WINDOW *) initscr (void); /* implemented */ +extern NCURSES_EXPORT(int) init_color (short,short,short,short); /* implemented */ +extern NCURSES_EXPORT(int) init_pair (short,short,short); /* implemented */ +extern NCURSES_EXPORT(int) innstr (char *, int); /* generated */ +extern NCURSES_EXPORT(int) insch (chtype); /* generated */ +extern NCURSES_EXPORT(int) insdelln (int); /* generated */ +extern NCURSES_EXPORT(int) insertln (void); /* generated */ +extern NCURSES_EXPORT(int) insnstr (const char *, int); /* generated */ +extern NCURSES_EXPORT(int) insstr (const char *); /* generated */ +extern NCURSES_EXPORT(int) instr (char *); /* generated */ +extern NCURSES_EXPORT(int) intrflush (WINDOW *,bool); /* implemented */ +extern NCURSES_EXPORT(bool) isendwin (void); /* implemented */ +extern NCURSES_EXPORT(bool) is_linetouched (WINDOW *,int); /* implemented */ +extern NCURSES_EXPORT(bool) is_wintouched (WINDOW *); /* implemented */ +extern NCURSES_EXPORT(NCURSES_CONST char *) keyname (int); /* implemented */ +extern NCURSES_EXPORT(int) keypad (WINDOW *,bool); /* implemented */ +extern NCURSES_EXPORT(char) killchar (void); /* implemented */ +extern NCURSES_EXPORT(int) leaveok (WINDOW *,bool); /* implemented */ +extern NCURSES_EXPORT(char *) longname (void); /* implemented */ +extern NCURSES_EXPORT(int) meta (WINDOW *,bool); /* implemented */ +extern NCURSES_EXPORT(int) move (int, int); /* generated */ +extern NCURSES_EXPORT(int) mvaddch (int, int, const chtype); /* generated */ +extern NCURSES_EXPORT(int) mvaddchnstr (int, int, const chtype *, int); /* generated */ +extern NCURSES_EXPORT(int) mvaddchstr (int, int, const chtype *); /* generated */ +extern NCURSES_EXPORT(int) mvaddnstr (int, int, const char *, int); /* generated */ +extern NCURSES_EXPORT(int) mvaddstr (int, int, const char *); /* generated */ +extern NCURSES_EXPORT(int) mvchgat (int, int, int, attr_t, short, const void *); /* generated */ +extern NCURSES_EXPORT(int) mvcur (int,int,int,int); /* implemented */ +extern NCURSES_EXPORT(int) mvdelch (int, int); /* generated */ +extern NCURSES_EXPORT(int) mvderwin (WINDOW *, int, int); /* implemented */ +extern NCURSES_EXPORT(int) mvgetch (int, int); /* generated */ +extern NCURSES_EXPORT(int) mvgetnstr (int, int, char *, int); /* generated */ +extern NCURSES_EXPORT(int) mvgetstr (int, int, char *); /* generated */ +extern NCURSES_EXPORT(int) mvhline (int, int, chtype, int); /* generated */ +extern NCURSES_EXPORT(chtype) mvinch (int, int); /* generated */ +extern NCURSES_EXPORT(int) mvinchnstr (int, int, chtype *, int); /* generated */ +extern NCURSES_EXPORT(int) mvinchstr (int, int, chtype *); /* generated */ +extern NCURSES_EXPORT(int) mvinnstr (int, int, char *, int); /* generated */ +extern NCURSES_EXPORT(int) mvinsch (int, int, chtype); /* generated */ +extern NCURSES_EXPORT(int) mvinsnstr (int, int, const char *, int); /* generated */ +extern NCURSES_EXPORT(int) mvinsstr (int, int, const char *); /* generated */ +extern NCURSES_EXPORT(int) mvinstr (int, int, char *); /* generated */ +extern NCURSES_EXPORT(int) mvprintw (int,int, NCURSES_CONST char *,...) /* implemented */ + GCC_PRINTFLIKE(3,4); +extern NCURSES_EXPORT(int) mvscanw (int,int, NCURSES_CONST char *,...) /* implemented */ + GCC_SCANFLIKE(3,4); +extern NCURSES_EXPORT(int) mvvline (int, int, chtype, int); /* generated */ +extern NCURSES_EXPORT(int) mvwaddch (WINDOW *, int, int, const chtype); /* generated */ +extern NCURSES_EXPORT(int) mvwaddchnstr (WINDOW *, int, int, const chtype *, int);/* generated */ +extern NCURSES_EXPORT(int) mvwaddchstr (WINDOW *, int, int, const chtype *); /* generated */ +extern NCURSES_EXPORT(int) mvwaddnstr (WINDOW *, int, int, const char *, int); /* generated */ +extern NCURSES_EXPORT(int) mvwaddstr (WINDOW *, int, int, const char *); /* generated */ +extern NCURSES_EXPORT(int) mvwchgat (WINDOW *, int, int, int, attr_t, short, const void *);/* generated */ +extern NCURSES_EXPORT(int) mvwdelch (WINDOW *, int, int); /* generated */ +extern NCURSES_EXPORT(int) mvwgetch (WINDOW *, int, int); /* generated */ +extern NCURSES_EXPORT(int) mvwgetnstr (WINDOW *, int, int, char *, int); /* generated */ +extern NCURSES_EXPORT(int) mvwgetstr (WINDOW *, int, int, char *); /* generated */ +extern NCURSES_EXPORT(int) mvwhline (WINDOW *, int, int, chtype, int); /* generated */ +extern NCURSES_EXPORT(int) mvwin (WINDOW *,int,int); /* implemented */ +extern NCURSES_EXPORT(chtype) mvwinch (WINDOW *, int, int); /* generated */ +extern NCURSES_EXPORT(int) mvwinchnstr (WINDOW *, int, int, chtype *, int); /* generated */ +extern NCURSES_EXPORT(int) mvwinchstr (WINDOW *, int, int, chtype *); /* generated */ +extern NCURSES_EXPORT(int) mvwinnstr (WINDOW *, int, int, char *, int); /* generated */ +extern NCURSES_EXPORT(int) mvwinsch (WINDOW *, int, int, chtype); /* generated */ +extern NCURSES_EXPORT(int) mvwinsnstr (WINDOW *, int, int, const char *, int); /* generated */ +extern NCURSES_EXPORT(int) mvwinsstr (WINDOW *, int, int, const char *); /* generated */ +extern NCURSES_EXPORT(int) mvwinstr (WINDOW *, int, int, char *); /* generated */ +extern NCURSES_EXPORT(int) mvwprintw (WINDOW*,int,int, NCURSES_CONST char *,...) /* implemented */ + GCC_PRINTFLIKE(4,5); +extern NCURSES_EXPORT(int) mvwscanw (WINDOW *,int,int, NCURSES_CONST char *,...) /* implemented */ + GCC_SCANFLIKE(4,5); +extern NCURSES_EXPORT(int) mvwvline (WINDOW *,int, int, chtype, int); /* generated */ +extern NCURSES_EXPORT(int) napms (int); /* implemented */ +extern NCURSES_EXPORT(WINDOW *) newpad (int,int); /* implemented */ +extern NCURSES_EXPORT(SCREEN *) newterm (NCURSES_CONST char *,FILE *,FILE *); /* implemented */ +extern NCURSES_EXPORT(WINDOW *) newwin (int,int,int,int); /* implemented */ +extern NCURSES_EXPORT(int) nl (void); /* implemented */ +extern NCURSES_EXPORT(int) nocbreak (void); /* implemented */ +extern NCURSES_EXPORT(int) nodelay (WINDOW *,bool); /* implemented */ +extern NCURSES_EXPORT(int) noecho (void); /* implemented */ +extern NCURSES_EXPORT(int) nonl (void); /* implemented */ +extern NCURSES_EXPORT(void) noqiflush (void); /* implemented */ +extern NCURSES_EXPORT(int) noraw (void); /* implemented */ +extern NCURSES_EXPORT(int) notimeout (WINDOW *,bool); /* implemented */ +extern NCURSES_EXPORT(int) overlay (const WINDOW*,WINDOW *); /* implemented */ +extern NCURSES_EXPORT(int) overwrite (const WINDOW*,WINDOW *); /* implemented */ +extern NCURSES_EXPORT(int) pair_content (short,short*,short*); /* implemented */ +extern NCURSES_EXPORT(int) PAIR_NUMBER (int); /* generated */ +extern NCURSES_EXPORT(int) pechochar (WINDOW *, const chtype); /* implemented */ +extern NCURSES_EXPORT(int) pnoutrefresh (WINDOW*,int,int,int,int,int,int);/* implemented */ +extern NCURSES_EXPORT(int) prefresh (WINDOW *,int,int,int,int,int,int); /* implemented */ +extern NCURSES_EXPORT(int) printw (NCURSES_CONST char *,...) /* implemented */ + GCC_PRINTFLIKE(1,2); +extern NCURSES_EXPORT(int) putp (const char *); /* implemented */ +extern NCURSES_EXPORT(int) putwin (WINDOW *, FILE *); /* implemented */ +extern NCURSES_EXPORT(void) qiflush (void); /* implemented */ +extern NCURSES_EXPORT(int) raw (void); /* implemented */ +extern NCURSES_EXPORT(int) redrawwin (WINDOW *); /* generated */ +extern NCURSES_EXPORT(int) refresh (void); /* generated */ +extern NCURSES_EXPORT(int) resetty (void); /* implemented */ +extern NCURSES_EXPORT(int) reset_prog_mode (void); /* implemented */ +extern NCURSES_EXPORT(int) reset_shell_mode (void); /* implemented */ +extern NCURSES_EXPORT(int) ripoffline (int, int (*)(WINDOW *, int)); /* implemented */ +extern NCURSES_EXPORT(int) savetty (void); /* implemented */ +extern NCURSES_EXPORT(int) scanw (NCURSES_CONST char *,...) /* implemented */ + GCC_SCANFLIKE(1,2); +extern NCURSES_EXPORT(int) scr_dump (const char *); /* implemented */ +extern NCURSES_EXPORT(int) scr_init (const char *); /* implemented */ +extern NCURSES_EXPORT(int) scrl (int); /* generated */ +extern NCURSES_EXPORT(int) scroll (WINDOW *); /* generated */ +extern NCURSES_EXPORT(int) scrollok (WINDOW *,bool); /* implemented */ +extern NCURSES_EXPORT(int) scr_restore (const char *); /* implemented */ +extern NCURSES_EXPORT(int) scr_set (const char *); /* implemented */ +extern NCURSES_EXPORT(int) setscrreg (int,int); /* generated */ +extern NCURSES_EXPORT(SCREEN *) set_term (SCREEN *); /* implemented */ +extern NCURSES_EXPORT(int) slk_attroff (const chtype); /* implemented */ +extern NCURSES_EXPORT(int) slk_attr_off (const attr_t, void *); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) slk_attron (const chtype); /* implemented */ +extern NCURSES_EXPORT(int) slk_attr_on (attr_t,void*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) slk_attrset (const chtype); /* implemented */ +extern NCURSES_EXPORT(attr_t) slk_attr (void); /* implemented */ +extern NCURSES_EXPORT(int) slk_attr_set (const attr_t,short,void*); /* implemented */ +extern NCURSES_EXPORT(int) slk_clear (void); /* implemented */ +extern NCURSES_EXPORT(int) slk_color (short); /* implemented */ +extern NCURSES_EXPORT(int) slk_init (int); /* implemented */ +extern NCURSES_EXPORT(char *) slk_label (int); /* implemented */ +extern NCURSES_EXPORT(int) slk_noutrefresh (void); /* implemented */ +extern NCURSES_EXPORT(int) slk_refresh (void); /* implemented */ +extern NCURSES_EXPORT(int) slk_restore (void); /* implemented */ +extern NCURSES_EXPORT(int) slk_set (int,const char *,int); /* implemented */ +extern NCURSES_EXPORT(int) slk_touch (void); /* implemented */ +extern NCURSES_EXPORT(int) standout (void); /* generated */ +extern NCURSES_EXPORT(int) standend (void); /* generated */ +extern NCURSES_EXPORT(int) start_color (void); /* implemented */ +extern NCURSES_EXPORT(WINDOW *) subpad (WINDOW *, int, int, int, int); /* implemented */ +extern NCURSES_EXPORT(WINDOW *) subwin (WINDOW *,int,int,int,int); /* implemented */ +extern NCURSES_EXPORT(int) syncok (WINDOW *, bool); /* implemented */ +extern NCURSES_EXPORT(chtype) termattrs (void); /* implemented */ +extern NCURSES_EXPORT(char *) termname (void); /* implemented */ +extern NCURSES_EXPORT(int) tigetflag (NCURSES_CONST char *); /* implemented */ +extern NCURSES_EXPORT(int) tigetnum (NCURSES_CONST char *); /* implemented */ +extern NCURSES_EXPORT(char *) tigetstr (NCURSES_CONST char *); /* implemented */ +extern NCURSES_EXPORT(void) timeout (int); /* generated */ +extern NCURSES_EXPORT(int) touchline (WINDOW *, int, int); /* generated */ +extern NCURSES_EXPORT(int) touchwin (WINDOW *); /* generated */ +extern NCURSES_EXPORT(char *) tparm (NCURSES_CONST char *, ...); /* implemented */ +extern NCURSES_EXPORT(int) typeahead (int); /* implemented */ +extern NCURSES_EXPORT(int) ungetch (int); /* implemented */ +extern NCURSES_EXPORT(int) untouchwin (WINDOW *); /* generated */ +extern NCURSES_EXPORT(void) use_env (bool); /* implemented */ +extern NCURSES_EXPORT(int) vidattr (chtype); /* implemented */ +extern NCURSES_EXPORT(int) vidputs (chtype, int (*)(int)); /* implemented */ +extern NCURSES_EXPORT(int) vline (chtype, int); /* generated */ +extern NCURSES_EXPORT(int) vwprintw (WINDOW *, NCURSES_CONST char *,va_list); /* implemented */ +extern NCURSES_EXPORT(int) vw_printw (WINDOW *, NCURSES_CONST char *,va_list); /* generated */ +extern NCURSES_EXPORT(int) vwscanw (WINDOW *, NCURSES_CONST char *,va_list); /* implemented */ +extern NCURSES_EXPORT(int) vw_scanw (WINDOW *, NCURSES_CONST char *,va_list); /* generated */ +extern NCURSES_EXPORT(int) waddch (WINDOW *, const chtype); /* implemented */ +extern NCURSES_EXPORT(int) waddchnstr (WINDOW *,const chtype *const,int); /* implemented */ +extern NCURSES_EXPORT(int) waddchstr (WINDOW *,const chtype *); /* generated */ +extern NCURSES_EXPORT(int) waddnstr (WINDOW *,const char *const,int); /* implemented */ +extern NCURSES_EXPORT(int) waddstr (WINDOW *,const char *); /* generated */ +extern NCURSES_EXPORT(int) wattron (WINDOW *, int); /* generated */ +extern NCURSES_EXPORT(int) wattroff (WINDOW *, int); /* generated */ +extern NCURSES_EXPORT(int) wattrset (WINDOW *, int); /* generated */ +extern NCURSES_EXPORT(int) wattr_get (WINDOW *, attr_t *, short *, void *); /* generated */ +extern NCURSES_EXPORT(int) wattr_on (WINDOW *, NCURSES_CONST attr_t, void *); /* implemented */ +extern NCURSES_EXPORT(int) wattr_off (WINDOW *, NCURSES_CONST attr_t, void *); /* implemented */ +extern NCURSES_EXPORT(int) wattr_set (WINDOW *, attr_t, short, void *); /* generated */ +extern NCURSES_EXPORT(int) wbkgd (WINDOW *,const chtype); /* implemented */ +extern NCURSES_EXPORT(void) wbkgdset (WINDOW *,chtype); /* implemented */ +extern NCURSES_EXPORT(int) wborder (WINDOW *,chtype,chtype,chtype,chtype,chtype,chtype,chtype,chtype); /* implemented */ +extern NCURSES_EXPORT(int) wchgat (WINDOW *, int, attr_t, short, const void *);/* implemented */ +extern NCURSES_EXPORT(int) wclear (WINDOW *); /* implemented */ +extern NCURSES_EXPORT(int) wclrtobot (WINDOW *); /* implemented */ +extern NCURSES_EXPORT(int) wclrtoeol (WINDOW *); /* implemented */ +extern NCURSES_EXPORT(int) wcolor_set (WINDOW*,short,void*); /* implemented */ +extern NCURSES_EXPORT(void) wcursyncup (WINDOW *); /* implemented */ +extern NCURSES_EXPORT(int) wdelch (WINDOW *); /* implemented */ +extern NCURSES_EXPORT(int) wdeleteln (WINDOW *); /* generated */ +extern NCURSES_EXPORT(int) wechochar (WINDOW *, const chtype); /* implemented */ +extern NCURSES_EXPORT(int) werase (WINDOW *); /* implemented */ +extern NCURSES_EXPORT(int) wgetch (WINDOW *); /* implemented */ +extern NCURSES_EXPORT(int) wgetnstr (WINDOW *,char *,int); /* implemented */ +extern NCURSES_EXPORT(int) wgetstr (WINDOW *, char *); /* generated */ +extern NCURSES_EXPORT(int) whline (WINDOW *, chtype, int); /* implemented */ +extern NCURSES_EXPORT(chtype) winch (WINDOW *); /* implemented */ +extern NCURSES_EXPORT(int) winchnstr (WINDOW *, chtype *, int); /* implemented */ +extern NCURSES_EXPORT(int) winchstr (WINDOW *, chtype *); /* generated */ +extern NCURSES_EXPORT(int) winnstr (WINDOW *, char *, int); /* implemented */ +extern NCURSES_EXPORT(int) winsch (WINDOW *, chtype); /* implemented */ +extern NCURSES_EXPORT(int) winsdelln (WINDOW *,int); /* implemented */ +extern NCURSES_EXPORT(int) winsertln (WINDOW *); /* generated */ +extern NCURSES_EXPORT(int) winsnstr (WINDOW *, const char *,int); /* implemented */ +extern NCURSES_EXPORT(int) winsstr (WINDOW *, const char *); /* generated */ +extern NCURSES_EXPORT(int) winstr (WINDOW *, char *); /* generated */ +extern NCURSES_EXPORT(int) wmove (WINDOW *,int,int); /* implemented */ +extern NCURSES_EXPORT(int) wnoutrefresh (WINDOW *); /* implemented */ +extern NCURSES_EXPORT(int) wprintw (WINDOW *, NCURSES_CONST char *,...) /* implemented */ + GCC_PRINTFLIKE(2,3); +extern NCURSES_EXPORT(int) wredrawln (WINDOW *,int,int); /* implemented */ +extern NCURSES_EXPORT(int) wrefresh (WINDOW *); /* implemented */ +extern NCURSES_EXPORT(int) wscanw (WINDOW *, NCURSES_CONST char *,...) /* implemented */ + GCC_SCANFLIKE(2,3); +extern NCURSES_EXPORT(int) wscrl (WINDOW *,int); /* implemented */ +extern NCURSES_EXPORT(int) wsetscrreg (WINDOW *,int,int); /* implemented */ +extern NCURSES_EXPORT(int) wstandout (WINDOW *); /* generated */ +extern NCURSES_EXPORT(int) wstandend (WINDOW *); /* generated */ +extern NCURSES_EXPORT(void) wsyncdown (WINDOW *); /* implemented */ +extern NCURSES_EXPORT(void) wsyncup (WINDOW *); /* implemented */ +extern NCURSES_EXPORT(void) wtimeout (WINDOW *,int); /* implemented */ +extern NCURSES_EXPORT(int) wtouchln (WINDOW *,int,int,int); /* implemented */ +extern NCURSES_EXPORT(int) wvline (WINDOW *,chtype,int); /* implemented */ + +/* + * vid_attr() was implemented originally based on the draft of XSI curses. + */ +#ifndef _XOPEN_SOURCE_EXTENDED +#define vid_attr(a,pair,opts) vidattr(a) +#endif + +/* attributes */ + +#define NCURSES_ATTR_SHIFT 8 +#define NCURSES_BITS(mask,shift) ((mask) << ((shift) + NCURSES_ATTR_SHIFT)) + +#define A_NORMAL 0L +#define A_ATTRIBUTES NCURSES_BITS(~(1UL - 1UL),0) +#define A_CHARTEXT (NCURSES_BITS(1UL,0) - 1UL) +#define A_COLOR NCURSES_BITS(((1UL) << 8) - 1UL,0) +#define A_STANDOUT NCURSES_BITS(1UL,8) +#define A_UNDERLINE NCURSES_BITS(1UL,9) +#define A_REVERSE NCURSES_BITS(1UL,10) +#define A_BLINK NCURSES_BITS(1UL,11) +#define A_DIM NCURSES_BITS(1UL,12) +#define A_BOLD NCURSES_BITS(1UL,13) +#define A_ALTCHARSET NCURSES_BITS(1UL,14) +#define A_INVIS NCURSES_BITS(1UL,15) +#define A_PROTECT NCURSES_BITS(1UL,16) +#define A_HORIZONTAL NCURSES_BITS(1UL,17) +#define A_LEFT NCURSES_BITS(1UL,18) +#define A_LOW NCURSES_BITS(1UL,19) +#define A_RIGHT NCURSES_BITS(1UL,20) +#define A_TOP NCURSES_BITS(1UL,21) +#define A_VERTICAL NCURSES_BITS(1UL,22) + +#define COLOR_PAIR(n) NCURSES_BITS(n, 0) +#define PAIR_NUMBER(a) (((a) & A_COLOR) >> NCURSES_ATTR_SHIFT) + +/* + * pseudo functions + */ +#define wgetstr(w, s) wgetnstr(w, s, -1) +#define getnstr(s, n) wgetnstr(stdscr, s, n) + +#define setterm(term) setupterm(term, 1, (int *)0) + +#define fixterm() reset_prog_mode() +#define resetterm() reset_shell_mode() +#define saveterm() def_prog_mode() +#define crmode() cbreak() +#define nocrmode() nocbreak() +#define gettmode() + +#define getyx(win,y,x) (y = (win)?(win)->_cury:ERR, x = (win)?(win)->_curx:ERR) +#define getbegyx(win,y,x) (y = (win)?(win)->_begy:ERR, x = (win)?(win)->_begx:ERR) +#define getmaxyx(win,y,x) (y = (win)?((win)->_maxy + 1):ERR, x = (win)?((win)->_maxx + 1):ERR) +#define getparyx(win,y,x) (y = (win)?(win)->_pary:ERR, x = (win)?(win)->_parx:ERR) +#define getsyx(y,x) do { if(newscr->_leaveok) (y)=(x)=-1; \ + else getyx(newscr,(y),(x)); \ + } while(0) +#define setsyx(y,x) do { if((y)==-1 && (x)==-1) newscr->_leaveok=TRUE; \ + else {newscr->_leaveok=FALSE;wmove(newscr,(y),(x));} \ + } while(0) + +/* It seems older SYSV curses versions define these */ +#define getattrs(win) ((win)?(win)->_attrs:A_NORMAL) +#define getcurx(win) ((win)?(win)->_curx:ERR) +#define getcury(win) ((win)?(win)->_cury:ERR) +#define getbegx(win) ((win)?(win)->_begx:ERR) +#define getbegy(win) ((win)?(win)->_begy:ERR) +#define getmaxx(win) ((win)?((win)->_maxx + 1):ERR) +#define getmaxy(win) ((win)?((win)->_maxy + 1):ERR) +#define getparx(win) ((win)?(win)->_parx:ERR) +#define getpary(win) ((win)?(win)->_pary:ERR) + +#define wstandout(win) (wattrset(win,A_STANDOUT)) +#define wstandend(win) (wattrset(win,A_NORMAL)) +#define wattr_set(win,a,p,opts) ((win)->_attrs = (((a) & ~A_COLOR) | COLOR_PAIR(p)), OK) + +#define wattron(win,at) wattr_on(win, at, (void *)0) +#define wattroff(win,at) wattr_off(win, at, (void *)0) +#define wattrset(win,at) ((win)->_attrs = (at)) + +#define scroll(win) wscrl(win,1) + +#define touchwin(win) wtouchln((win), 0, getmaxy(win), 1) +#define touchline(win, s, c) wtouchln((win), s, c, 1) +#define untouchwin(win) wtouchln((win), 0, getmaxy(win), 0) + +#define box(win, v, h) wborder(win, v, v, h, h, 0, 0, 0, 0) +#define border(ls, rs, ts, bs, tl, tr, bl, br) wborder(stdscr, ls, rs, ts, bs, tl, tr, bl, br) +#define hline(ch, n) whline(stdscr, ch, n) +#define vline(ch, n) wvline(stdscr, ch, n) + +#define winstr(w, s) winnstr(w, s, -1) +#define winchstr(w, s) winchnstr(w, s, -1) +#define winsstr(w, s) winsnstr(w, s, -1) + +#define redrawwin(win) wredrawln(win, 0, (win)->_maxy+1) +#define waddstr(win,str) waddnstr(win,str,-1) +#define waddchstr(win,str) waddchnstr(win,str,-1) + +/* + * pseudo functions for standard screen + */ + +#define addch(ch) waddch(stdscr,ch) +#define addchnstr(str,n) waddchnstr(stdscr,str,n) +#define addchstr(str) waddchstr(stdscr,str) +#define addnstr(str,n) waddnstr(stdscr,str,n) +#define addstr(str) waddnstr(stdscr,str,-1) +#define attroff(at) wattroff(stdscr,at) +#define attron(at) wattron(stdscr,at) +#define attrset(at) wattrset(stdscr,at) +#define attr_get(ap,cp,o) wattr_get(stdscr,ap,cp,o) +#define attr_off(a,o) wattr_off(stdscr,a,o) +#define attr_on(a,o) wattr_on(stdscr,a,o) +#define attr_set(a,c,o) wattr_set(stdscr,a,c,o) +#define bkgd(ch) wbkgd(stdscr,ch) +#define bkgdset(ch) wbkgdset(stdscr,ch) +#define chgat(n,a,c,o) wchgat(stdscr,n,a,c,o) +#define clear() wclear(stdscr) +#define clrtobot() wclrtobot(stdscr) +#define clrtoeol() wclrtoeol(stdscr) +#define color_set(c,o) wcolor_set(stdscr,c,o) +#define delch() wdelch(stdscr) +#define deleteln() winsdelln(stdscr,-1) +#define echochar(c) wechochar(stdscr,c) +#define erase() werase(stdscr) +#define getch() wgetch(stdscr) +#define getstr(str) wgetstr(stdscr,str) +#define inch() winch(stdscr) +#define inchnstr(s,n) winchnstr(stdscr,s,n) +#define inchstr(s) winchstr(stdscr,s) +#define innstr(s,n) winnstr(stdscr,s,n) +#define insch(c) winsch(stdscr,c) +#define insdelln(n) winsdelln(stdscr,n) +#define insertln() winsdelln(stdscr,1) +#define insnstr(s,n) winsnstr(stdscr,s,n) +#define insstr(s) winsstr(stdscr,s) +#define instr(s) winstr(stdscr,s) +#define move(y,x) wmove(stdscr,y,x) +#define refresh() wrefresh(stdscr) +#define scrl(n) wscrl(stdscr,n) +#define setscrreg(t,b) wsetscrreg(stdscr,t,b) +#define standend() wstandend(stdscr) +#define standout() wstandout(stdscr) +#define timeout(delay) wtimeout(stdscr,delay) +#define wdeleteln(win) winsdelln(win,-1) +#define winsertln(win) winsdelln(win,1) + +/* + * mv functions + */ + +#define mvwaddch(win,y,x,ch) (wmove(win,y,x) == ERR ? ERR : waddch(win,ch)) +#define mvwaddchnstr(win,y,x,str,n) (wmove(win,y,x) == ERR ? ERR : waddchnstr(win,str,n)) +#define mvwaddchstr(win,y,x,str) (wmove(win,y,x) == ERR ? ERR : waddchnstr(win,str,-1)) +#define mvwaddnstr(win,y,x,str,n) (wmove(win,y,x) == ERR ? ERR : waddnstr(win,str,n)) +#define mvwaddstr(win,y,x,str) (wmove(win,y,x) == ERR ? ERR : waddnstr(win,str,-1)) +#define mvwdelch(win,y,x) (wmove(win,y,x) == ERR ? ERR : wdelch(win)) +#define mvwchgat(win,y,x,n,a,c,o) (wmove(win,y,x) == ERR ? ERR : wchgat(win,n,a,c,o)) +#define mvwgetch(win,y,x) (wmove(win,y,x) == ERR ? ERR : wgetch(win)) +#define mvwgetnstr(win,y,x,str,n) (wmove(win,y,x) == ERR ? ERR : wgetnstr(win,str,n)) +#define mvwgetstr(win,y,x,str) (wmove(win,y,x) == ERR ? ERR : wgetstr(win,str)) +#define mvwhline(win,y,x,c,n) (wmove(win,y,x) == ERR ? ERR : whline(win,c,n)) +#define mvwinch(win,y,x) (wmove(win,y,x) == ERR ? (chtype)ERR : winch(win)) +#define mvwinchnstr(win,y,x,s,n) (wmove(win,y,x) == ERR ? ERR : winchnstr(win,s,n)) +#define mvwinchstr(win,y,x,s) (wmove(win,y,x) == ERR ? ERR : winchstr(win,s)) +#define mvwinnstr(win,y,x,s,n) (wmove(win,y,x) == ERR ? ERR : winnstr(win,s,n)) +#define mvwinsch(win,y,x,c) (wmove(win,y,x) == ERR ? ERR : winsch(win,c)) +#define mvwinsnstr(win,y,x,s,n) (wmove(win,y,x) == ERR ? ERR : winsnstr(win,s,n)) +#define mvwinsstr(win,y,x,s) (wmove(win,y,x) == ERR ? ERR : winsstr(win,s)) +#define mvwinstr(win,y,x,s) (wmove(win,y,x) == ERR ? ERR : winstr(win,s)) +#define mvwvline(win,y,x,c,n) (wmove(win,y,x) == ERR ? ERR : wvline(win,c,n)) + +#define mvaddch(y,x,ch) mvwaddch(stdscr,y,x,ch) +#define mvaddchnstr(y,x,str,n) mvwaddchnstr(stdscr,y,x,str,n) +#define mvaddchstr(y,x,str) mvwaddchstr(stdscr,y,x,str) +#define mvaddnstr(y,x,str,n) mvwaddnstr(stdscr,y,x,str,n) +#define mvaddstr(y,x,str) mvwaddstr(stdscr,y,x,str) +#define mvchgat(y,x,n,a,c,o) mvwchgat(stdscr,y,x,n,a,c,o) +#define mvdelch(y,x) mvwdelch(stdscr,y,x) +#define mvgetch(y,x) mvwgetch(stdscr,y,x) +#define mvgetnstr(y,x,str,n) mvwgetnstr(stdscr,y,x,str,n) +#define mvgetstr(y,x,str) mvwgetstr(stdscr,y,x,str) +#define mvhline(y,x,c,n) mvwhline(stdscr,y,x,c,n) +#define mvinch(y,x) mvwinch(stdscr,y,x) +#define mvinchnstr(y,x,s,n) mvwinchnstr(stdscr,y,x,s,n) +#define mvinchstr(y,x,s) mvwinchstr(stdscr,y,x,s) +#define mvinnstr(y,x,s,n) mvwinnstr(stdscr,y,x,s,n) +#define mvinsch(y,x,c) mvwinsch(stdscr,y,x,c) +#define mvinsnstr(y,x,s,n) mvwinsnstr(stdscr,y,x,s,n) +#define mvinsstr(y,x,s) mvwinsstr(stdscr,y,x,s) +#define mvinstr(y,x,s) mvwinstr(stdscr,y,x,s) +#define mvvline(y,x,c,n) mvwvline(stdscr,y,x,c,n) + +/* + * Some wide-character functions do not depend on the extensions. + */ +#define getbkgd(win) ((win)->_bkgd) + +#define slk_attr_off(a,v) ((v) ? ERR : slk_attroff(a)) +#define slk_attr_on(a,v) ((v) ? ERR : slk_attron(a)) + +#define wattr_get(win,a,p,opts) ((void)((a) != 0 && (*(a) = (win)->_attrs)), \ + (void)((p) != 0 && (*(p) = PAIR_NUMBER((win)->_attrs))), \ + OK) + +/* + * XSI curses deprecates SVr4 vwprintw/vwscanw, which are supposed to use + * varargs.h. It adds new calls vw_printw/vw_scanw, which are supposed to + * use POSIX stdarg.h. The ncurses versions of vwprintw/vwscanw already + * use stdarg.h, so... + */ +#define vw_printw vwprintw +#define vw_scanw vwscanw + +/* + * Export fallback function for use in C++ binding. + */ +#if !1 +#define vsscanf(a,b,c) _nc_vsscanf(a,b,c) +NCURSES_EXPORT(int) vsscanf(const char *, const char *, va_list); +#endif + +/* + * Pseudo-character tokens outside ASCII range. The curses wgetch() function + * will return any given one of these only if the corresponding k- capability + * is defined in your terminal's terminfo entry. + * + * Some keys (KEY_A1, etc) are arranged like this: + * a1 up a3 + * left b2 right + * c1 down c3 + * + * A few key codes do not depend upon the terminfo entry. + */ +#define KEY_CODE_YES 0400 /* A wchar_t contains a key code */ +#define KEY_MIN 0401 /* Minimum curses key */ +#define KEY_BREAK 0401 /* Break key (unreliable) */ +#define KEY_SRESET 0530 /* Soft (partial) reset (unreliable) */ +#define KEY_RESET 0531 /* Reset or hard reset (unreliable) */ +/* + * These definitions were generated by /usr/src/lib/libncurses/../../contrib/ncurses/include/MKkey_defs.sh /usr/src/lib/libncurses/../../contrib/ncurses/include/Caps + */ +#define KEY_DOWN 0402 /* down-arrow key */ +#define KEY_UP 0403 /* up-arrow key */ +#define KEY_LEFT 0404 /* left-arrow key */ +#define KEY_RIGHT 0405 /* right-arrow key */ +#define KEY_HOME 0406 /* home key */ +#define KEY_BACKSPACE 0407 /* backspace key */ +#define KEY_F0 0410 /* Function keys. Space for 64 */ +#define KEY_F(n) (KEY_F0+(n)) /* Value of function key n */ +#define KEY_DL 0510 /* delete-line key */ +#define KEY_IL 0511 /* insert-line key */ +#define KEY_DC 0512 /* delete-character key */ +#define KEY_IC 0513 /* insert-character key */ +#define KEY_EIC 0514 /* sent by rmir or smir in insert mode */ +#define KEY_CLEAR 0515 /* clear-screen or erase key */ +#define KEY_EOS 0516 /* clear-to-end-of-screen key */ +#define KEY_EOL 0517 /* clear-to-end-of-line key */ +#define KEY_SF 0520 /* scroll-forward key */ +#define KEY_SR 0521 /* scroll-backward key */ +#define KEY_NPAGE 0522 /* next-page key */ +#define KEY_PPAGE 0523 /* previous-page key */ +#define KEY_STAB 0524 /* set-tab key */ +#define KEY_CTAB 0525 /* clear-tab key */ +#define KEY_CATAB 0526 /* clear-all-tabs key */ +#define KEY_ENTER 0527 /* enter/send key */ +#define KEY_PRINT 0532 /* print key */ +#define KEY_LL 0533 /* lower-left key (home down) */ +#define KEY_A1 0534 /* upper left of keypad */ +#define KEY_A3 0535 /* upper right of keypad */ +#define KEY_B2 0536 /* center of keypad */ +#define KEY_C1 0537 /* lower left of keypad */ +#define KEY_C3 0540 /* lower right of keypad */ +#define KEY_BTAB 0541 /* back-tab key */ +#define KEY_BEG 0542 /* begin key */ +#define KEY_CANCEL 0543 /* cancel key */ +#define KEY_CLOSE 0544 /* close key */ +#define KEY_COMMAND 0545 /* command key */ +#define KEY_COPY 0546 /* copy key */ +#define KEY_CREATE 0547 /* create key */ +#define KEY_END 0550 /* end key */ +#define KEY_EXIT 0551 /* exit key */ +#define KEY_FIND 0552 /* find key */ +#define KEY_HELP 0553 /* help key */ +#define KEY_MARK 0554 /* mark key */ +#define KEY_MESSAGE 0555 /* message key */ +#define KEY_MOVE 0556 /* move key */ +#define KEY_NEXT 0557 /* next key */ +#define KEY_OPEN 0560 /* open key */ +#define KEY_OPTIONS 0561 /* options key */ +#define KEY_PREVIOUS 0562 /* previous key */ +#define KEY_REDO 0563 /* redo key */ +#define KEY_REFERENCE 0564 /* reference key */ +#define KEY_REFRESH 0565 /* refresh key */ +#define KEY_REPLACE 0566 /* replace key */ +#define KEY_RESTART 0567 /* restart key */ +#define KEY_RESUME 0570 /* resume key */ +#define KEY_SAVE 0571 /* save key */ +#define KEY_SBEG 0572 /* shifted begin key */ +#define KEY_SCANCEL 0573 /* shifted cancel key */ +#define KEY_SCOMMAND 0574 /* shifted command key */ +#define KEY_SCOPY 0575 /* shifted copy key */ +#define KEY_SCREATE 0576 /* shifted create key */ +#define KEY_SDC 0577 /* shifted delete-character key */ +#define KEY_SDL 0600 /* shifted delete-line key */ +#define KEY_SELECT 0601 /* select key */ +#define KEY_SEND 0602 /* shifted end key */ +#define KEY_SEOL 0603 /* shifted clear-to-end-of-line key */ +#define KEY_SEXIT 0604 /* shifted exit key */ +#define KEY_SFIND 0605 /* shifted find key */ +#define KEY_SHELP 0606 /* shifted help key */ +#define KEY_SHOME 0607 /* shifted home key */ +#define KEY_SIC 0610 /* shifted insert-character key */ +#define KEY_SLEFT 0611 /* shifted left-arrow key */ +#define KEY_SMESSAGE 0612 /* shifted message key */ +#define KEY_SMOVE 0613 /* shifted move key */ +#define KEY_SNEXT 0614 /* shifted next key */ +#define KEY_SOPTIONS 0615 /* shifted options key */ +#define KEY_SPREVIOUS 0616 /* shifted previous key */ +#define KEY_SPRINT 0617 /* shifted print key */ +#define KEY_SREDO 0620 /* shifted redo key */ +#define KEY_SREPLACE 0621 /* shifted replace key */ +#define KEY_SRIGHT 0622 /* shifted right-arrow key */ +#define KEY_SRSUME 0623 /* shifted resume key */ +#define KEY_SSAVE 0624 /* shifted save key */ +#define KEY_SSUSPEND 0625 /* shifted suspend key */ +#define KEY_SUNDO 0626 /* shifted undo key */ +#define KEY_SUSPEND 0627 /* suspend key */ +#define KEY_UNDO 0630 /* undo key */ +#define KEY_MOUSE 0631 /* Mouse event has occurred */ +#define KEY_RESIZE 0632 /* Terminal resize event */ + +#define KEY_MAX 0777 /* Maximum key value is 0632 */ +/* $Id$ */ + +/* mouse interface */ +#define NCURSES_MOUSE_VERSION 1 + +/* event masks */ +#define BUTTON1_RELEASED 000000000001L +#define BUTTON1_PRESSED 000000000002L +#define BUTTON1_CLICKED 000000000004L +#define BUTTON1_DOUBLE_CLICKED 000000000010L +#define BUTTON1_TRIPLE_CLICKED 000000000020L +#define BUTTON1_RESERVED_EVENT 000000000040L +#define BUTTON2_RELEASED 000000000100L +#define BUTTON2_PRESSED 000000000200L +#define BUTTON2_CLICKED 000000000400L +#define BUTTON2_DOUBLE_CLICKED 000000001000L +#define BUTTON2_TRIPLE_CLICKED 000000002000L +#define BUTTON2_RESERVED_EVENT 000000004000L +#define BUTTON3_RELEASED 000000010000L +#define BUTTON3_PRESSED 000000020000L +#define BUTTON3_CLICKED 000000040000L +#define BUTTON3_DOUBLE_CLICKED 000000100000L +#define BUTTON3_TRIPLE_CLICKED 000000200000L +#define BUTTON3_RESERVED_EVENT 000000400000L +#define BUTTON4_RELEASED 000001000000L +#define BUTTON4_PRESSED 000002000000L +#define BUTTON4_CLICKED 000004000000L +#define BUTTON4_DOUBLE_CLICKED 000010000000L +#define BUTTON4_TRIPLE_CLICKED 000020000000L +#define BUTTON4_RESERVED_EVENT 000040000000L +#define BUTTON_CTRL 000100000000L +#define BUTTON_SHIFT 000200000000L +#define BUTTON_ALT 000400000000L +#define ALL_MOUSE_EVENTS 000777777777L +#define REPORT_MOUSE_POSITION 001000000000L + +/* macros to extract single event-bits from masks */ +#define BUTTON_RELEASE(e, x) ((e) & (001 << (6 * ((x) - 1)))) +#define BUTTON_PRESS(e, x) ((e) & (002 << (6 * ((x) - 1)))) +#define BUTTON_CLICK(e, x) ((e) & (004 << (6 * ((x) - 1)))) +#define BUTTON_DOUBLE_CLICK(e, x) ((e) & (010 << (6 * ((x) - 1)))) +#define BUTTON_TRIPLE_CLICK(e, x) ((e) & (020 << (6 * ((x) - 1)))) +#define BUTTON_RESERVED_EVENT(e, x) ((e) & (040 << (6 * ((x) - 1)))) + +typedef unsigned long mmask_t; + +typedef struct +{ + short id; /* ID to distinguish multiple devices */ + int x, y, z; /* event coordinates (character-cell) */ + mmask_t bstate; /* button state bits */ +} +MEVENT; + +extern NCURSES_EXPORT(int) getmouse (MEVENT *); +extern NCURSES_EXPORT(int) ungetmouse (MEVENT *); +extern NCURSES_EXPORT(mmask_t) mousemask (mmask_t, mmask_t *); +extern NCURSES_EXPORT(bool) wenclose (const WINDOW *, int, int); +extern NCURSES_EXPORT(int) mouseinterval (int); +extern NCURSES_EXPORT(bool) wmouse_trafo (const WINDOW* win,int* y, int* x, bool to_screen); +extern NCURSES_EXPORT(bool) mouse_trafo (int*, int*, bool); /* generated */ + +#define mouse_trafo(y,x,to_screen) wmouse_trafo(stdscr,y,x,to_screen) + +/* other non-XSI functions */ + +extern NCURSES_EXPORT(int) mcprint (char *, int); /* direct data to printer */ +extern NCURSES_EXPORT(int) has_key (int); /* do we have given key? */ + +/* Debugging : use with libncurses_g.a */ + +extern NCURSES_EXPORT(void) _tracef (const char *, ...) GCC_PRINTFLIKE(1,2); +extern NCURSES_EXPORT(void) _tracedump (const char *, WINDOW *); +extern NCURSES_EXPORT(char *) _traceattr (attr_t); +extern NCURSES_EXPORT(char *) _traceattr2 (int, chtype); +extern NCURSES_EXPORT(char *) _nc_tracebits (void); +extern NCURSES_EXPORT(char *) _tracechar (int); +extern NCURSES_EXPORT(char *) _tracechtype (chtype); +extern NCURSES_EXPORT(char *) _tracechtype2 (int, chtype); +#ifdef _XOPEN_SOURCE_EXTENDED +#define _tracech_t _tracecchar_t +extern NCURSES_EXPORT(char *) _tracecchar_t (const cchar_t *); +#define _tracech_t2 _tracecchar_t2 +extern NCURSES_EXPORT(char *) _tracecchar_t2 (int, const cchar_t *); +#else +#define _tracech_t _tracechtype +#define _tracech_t2 _tracechtype2 +#endif +extern NCURSES_EXPORT(char *) _tracemouse (const MEVENT *); +extern NCURSES_EXPORT(void) trace (const unsigned int); + +/* trace masks */ +#define TRACE_DISABLE 0x0000 /* turn off tracing */ +#define TRACE_TIMES 0x0001 /* trace user and system times of updates */ +#define TRACE_TPUTS 0x0002 /* trace tputs calls */ +#define TRACE_UPDATE 0x0004 /* trace update actions, old & new screens */ +#define TRACE_MOVE 0x0008 /* trace cursor moves and scrolls */ +#define TRACE_CHARPUT 0x0010 /* trace all character outputs */ +#define TRACE_ORDINARY 0x001F /* trace all update actions */ +#define TRACE_CALLS 0x0020 /* trace all curses calls */ +#define TRACE_VIRTPUT 0x0040 /* trace virtual character puts */ +#define TRACE_IEVENT 0x0080 /* trace low-level input processing */ +#define TRACE_BITS 0x0100 /* trace state of TTY control bits */ +#define TRACE_ICALLS 0x0200 /* trace internal/nested calls */ +#define TRACE_CCALLS 0x0400 /* trace per-character calls */ +#define TRACE_DATABASE 0x0800 /* trace read/write of terminfo/termcap data */ +#define TRACE_ATTRS 0x1000 /* trace attribute updates */ +#define TRACE_MAXIMUM 0xffff /* maximum trace level */ + +#if defined(TRACE) || defined(NCURSES_TEST) +extern NCURSES_EXPORT_VAR(int) _nc_optimize_enable; /* enable optimizations */ +#ifdef _XOPEN_SOURCE_EXTENDED +extern NCURSES_EXPORT(const char *) _nc_viswbuf(const wchar_t *); +#endif +extern NCURSES_EXPORT(const char *) _nc_visbuf (const char *); +#define OPTIMIZE_MVCUR 0x01 /* cursor movement optimization */ +#define OPTIMIZE_HASHMAP 0x02 /* diff hashing to detect scrolls */ +#define OPTIMIZE_SCROLL 0x04 /* scroll optimization */ +#define OPTIMIZE_ALL 0xff /* enable all optimizations (dflt) */ +#endif + +#ifdef __cplusplus + +/* these names conflict with STL */ +#undef box +#undef clear +#undef erase +#undef move +#undef refresh + +} +#endif + +#endif /* __NCURSES_H */ diff --git a/src/include.new/db.h b/src/include.new/db.h new file mode 100644 index 0000000..a3975f0 --- /dev/null +++ b/src/include.new/db.h @@ -0,0 +1,219 @@ +/*- + * Copyright (c) 1990, 1993, 1994 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)db.h 8.7 (Berkeley) 6/16/94 + * $FreeBSD: src/include/db.h,v 1.5 2002/03/26 01:35:05 bde Exp $ + */ + +#ifndef _DB_H_ +#define _DB_H_ + +#include +#include + +#include + +#define RET_ERROR -1 /* Return values. */ +#define RET_SUCCESS 0 +#define RET_SPECIAL 1 + +#define MAX_PAGE_NUMBER 0xffffffff /* >= # of pages in a file */ +typedef u_int32_t pgno_t; +#define MAX_PAGE_OFFSET 65535 /* >= # of bytes in a page */ +typedef u_int16_t indx_t; +#define MAX_REC_NUMBER 0xffffffff /* >= # of records in a tree */ +typedef u_int32_t recno_t; + +/* Key/data structure -- a Data-Base Thang. */ +typedef struct { + void *data; /* data */ + size_t size; /* data length */ +} DBT; + +/* Routine flags. */ +#define R_CURSOR 1 /* del, put, seq */ +#define __R_UNUSED 2 /* UNUSED */ +#define R_FIRST 3 /* seq */ +#define R_IAFTER 4 /* put (RECNO) */ +#define R_IBEFORE 5 /* put (RECNO) */ +#define R_LAST 6 /* seq (BTREE, RECNO) */ +#define R_NEXT 7 /* seq */ +#define R_NOOVERWRITE 8 /* put */ +#define R_PREV 9 /* seq (BTREE, RECNO) */ +#define R_SETCURSOR 10 /* put (RECNO) */ +#define R_RECNOSYNC 11 /* sync (RECNO) */ + +typedef enum { DB_BTREE, DB_HASH, DB_RECNO } DBTYPE; + +/* + * !!! + * The following flags are included in the dbopen(3) call as part of the + * open(2) flags. In order to avoid conflicts with the open flags, start + * at the top of the 16 or 32-bit number space and work our way down. If + * the open flags were significantly expanded in the future, it could be + * a problem. Wish I'd left another flags word in the dbopen call. + * + * !!! + * None of this stuff is implemented yet. The only reason that it's here + * is so that the access methods can skip copying the key/data pair when + * the DB_LOCK flag isn't set. + */ +#if UINT_MAX > 65535 +#define DB_LOCK 0x20000000 /* Do locking. */ +#define DB_SHMEM 0x40000000 /* Use shared memory. */ +#define DB_TXN 0x80000000 /* Do transactions. */ +#else +#define DB_LOCK 0x2000 /* Do locking. */ +#define DB_SHMEM 0x4000 /* Use shared memory. */ +#define DB_TXN 0x8000 /* Do transactions. */ +#endif + +/* Access method description structure. */ +typedef struct __db { + DBTYPE type; /* Underlying db type. */ + int (*close)(struct __db *); + int (*del)(const struct __db *, const DBT *, u_int); + int (*get)(const struct __db *, const DBT *, DBT *, u_int); + int (*put)(const struct __db *, DBT *, const DBT *, u_int); + int (*seq)(const struct __db *, DBT *, DBT *, u_int); + int (*sync)(const struct __db *, u_int); + void *internal; /* Access method private. */ + int (*fd)(const struct __db *); +} DB; + +#define BTREEMAGIC 0x053162 +#define BTREEVERSION 3 + +/* Structure used to pass parameters to the btree routines. */ +typedef struct { +#define R_DUP 0x01 /* duplicate keys */ + u_long flags; + u_int cachesize; /* bytes to cache */ + int maxkeypage; /* maximum keys per page */ + int minkeypage; /* minimum keys per page */ + u_int psize; /* page size */ + int (*compare) /* comparison function */ + (const DBT *, const DBT *); + size_t (*prefix) /* prefix function */ + (const DBT *, const DBT *); + int lorder; /* byte order */ +} BTREEINFO; + +#define HASHMAGIC 0x061561 +#define HASHVERSION 2 + +/* Structure used to pass parameters to the hashing routines. */ +typedef struct { + u_int bsize; /* bucket size */ + u_int ffactor; /* fill factor */ + u_int nelem; /* number of elements */ + u_int cachesize; /* bytes to cache */ + u_int32_t /* hash function */ + (*hash)(const void *, size_t); + int lorder; /* byte order */ +} HASHINFO; + +/* Structure used to pass parameters to the record routines. */ +typedef struct { +#define R_FIXEDLEN 0x01 /* fixed-length records */ +#define R_NOKEY 0x02 /* key not required */ +#define R_SNAPSHOT 0x04 /* snapshot the input */ + u_long flags; + u_int cachesize; /* bytes to cache */ + u_int psize; /* page size */ + int lorder; /* byte order */ + size_t reclen; /* record length (fixed-length records) */ + u_char bval; /* delimiting byte (variable-length records */ + char *bfname; /* btree file name */ +} RECNOINFO; + +#ifdef __DBINTERFACE_PRIVATE +/* + * Little endian <==> big endian 32-bit swap macros. + * M_32_SWAP swap a memory location + * P_32_SWAP swap a referenced memory location + * P_32_COPY swap from one location to another + */ +#define M_32_SWAP(a) { \ + u_int32_t _tmp = a; \ + ((char *)&a)[0] = ((char *)&_tmp)[3]; \ + ((char *)&a)[1] = ((char *)&_tmp)[2]; \ + ((char *)&a)[2] = ((char *)&_tmp)[1]; \ + ((char *)&a)[3] = ((char *)&_tmp)[0]; \ +} +#define P_32_SWAP(a) { \ + u_int32_t _tmp = *(u_int32_t *)a; \ + ((char *)a)[0] = ((char *)&_tmp)[3]; \ + ((char *)a)[1] = ((char *)&_tmp)[2]; \ + ((char *)a)[2] = ((char *)&_tmp)[1]; \ + ((char *)a)[3] = ((char *)&_tmp)[0]; \ +} +#define P_32_COPY(a, b) { \ + ((char *)&(b))[0] = ((char *)&(a))[3]; \ + ((char *)&(b))[1] = ((char *)&(a))[2]; \ + ((char *)&(b))[2] = ((char *)&(a))[1]; \ + ((char *)&(b))[3] = ((char *)&(a))[0]; \ +} + +/* + * Little endian <==> big endian 16-bit swap macros. + * M_16_SWAP swap a memory location + * P_16_SWAP swap a referenced memory location + * P_16_COPY swap from one location to another + */ +#define M_16_SWAP(a) { \ + u_int16_t _tmp = a; \ + ((char *)&a)[0] = ((char *)&_tmp)[1]; \ + ((char *)&a)[1] = ((char *)&_tmp)[0]; \ +} +#define P_16_SWAP(a) { \ + u_int16_t _tmp = *(u_int16_t *)a; \ + ((char *)a)[0] = ((char *)&_tmp)[1]; \ + ((char *)a)[1] = ((char *)&_tmp)[0]; \ +} +#define P_16_COPY(a, b) { \ + ((char *)&(b))[0] = ((char *)&(a))[1]; \ + ((char *)&(b))[1] = ((char *)&(a))[0]; \ +} +#endif + +__BEGIN_DECLS +DB *dbopen(const char *, int, int, DBTYPE, const void *); + +#ifdef __DBINTERFACE_PRIVATE +DB *__bt_open(const char *, int, int, const BTREEINFO *, int); +DB *__hash_open(const char *, int, int, const HASHINFO *, int); +DB *__rec_open(const char *, int, int, const RECNOINFO *, int); +void __dbpanic(DB *dbp); +#endif +__END_DECLS +#endif /* !_DB_H_ */ diff --git a/src/include.new/devinfo.h b/src/include.new/devinfo.h new file mode 100644 index 0000000..fcfc97f --- /dev/null +++ b/src/include.new/devinfo.h @@ -0,0 +1,147 @@ +/*- + * Copyright (c) 2000 Michael Smith + * Copyright (c) 2000 BSDi + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD: src/lib/libdevinfo/devinfo.h,v 1.4.14.1 2005/09/02 03:16:30 rodrigc Exp $ + */ + +#ifndef _DEVINFO_H_INCLUDED +#define _DEVINFO_H_INCLUDED + +#include +#include + +typedef __uintptr_t devinfo_handle_t; +#define DEVINFO_ROOT_DEVICE ((devinfo_handle_t)0) + +/* + * State of the device. + */ +/* XXX not sure if I want a copy here, or expose sys/bus.h */ +typedef enum devinfo_state { + DIS_NOTPRESENT, /* not probed or probe failed */ + DIS_ALIVE, /* probe succeeded */ + DIS_ATTACHED, /* attach method called */ + DIS_BUSY /* device is open */ +} devinfo_state_t; + +struct devinfo_dev { + devinfo_handle_t dd_handle; /* device handle */ + devinfo_handle_t dd_parent; /* parent handle */ + + char *dd_name; /* name of device */ + char *dd_desc; /* device description */ + char *dd_drivername; /* name of attached driver*/ + char *dd_pnpinfo; /* pnp info from parent bus */ + char *dd_location; /* Where bus thinks dev at */ + uint32_t dd_devflags; /* API flags */ + uint16_t dd_flags; /* internal dev flags */ + devinfo_state_t dd_state; /* attacement state of dev */ +}; + +struct devinfo_rman { + devinfo_handle_t dm_handle; /* resource manager handle */ + + unsigned long dm_start; /* resource start */ + unsigned long dm_size; /* resource size */ + + char *dm_desc; /* resource description */ +}; + +struct devinfo_res { + devinfo_handle_t dr_handle; /* resource handle */ + devinfo_handle_t dr_rman; /* resource manager handle */ + devinfo_handle_t dr_device; /* owning device */ + + unsigned long dr_start; /* region start */ + unsigned long dr_size; /* region size */ + /* XXX add flags */ +}; + +__BEGIN_DECLS + +/* + * Acquire a coherent copy of the kernel's device and resource tables. + * This must return success (zero) before any other interfaces will + * function. Sets errno on failure. + */ +extern int devinfo_init(void); + +/* + * Release the storage associated with the internal copy of the device + * and resource tables. devinfo_init must be called before any attempt + * is made to use any other interfaces. + */ +extern void devinfo_free(void); + +/* + * Find a device/resource/resource manager by its handle. + */ +extern struct devinfo_dev + *devinfo_handle_to_device(devinfo_handle_t handle); +extern struct devinfo_res + *devinfo_handle_to_resource(devinfo_handle_t handle); +extern struct devinfo_rman + *devinfo_handle_to_rman(devinfo_handle_t handle); + +/* + * Iterate over the children of a device, calling (fn) on each. If + * (fn) returns nonzero, abort the scan and return. + */ +extern int + devinfo_foreach_device_child(struct devinfo_dev *parent, + int (* fn)(struct devinfo_dev *child, void *arg), + void *arg); + +/* + * Iterate over all the resources owned by a device, calling (fn) on each. + * If (fn) returns nonzero, abort the scan and return. + */ +extern int + devinfo_foreach_device_resource(struct devinfo_dev *dev, + int (* fn)(struct devinfo_dev *dev, + struct devinfo_res *res, void *arg), + void *arg); + +/* + * Iterate over all the resources owned by a resource manager, calling (fn) + * on each. If (fn) returns nonzero, abort the scan and return. + */ +extern int + devinfo_foreach_rman_resource(struct devinfo_rman *rman, + int (* fn)(struct devinfo_res *res, void *arg), + void *arg); + +/* + * Iterate over all the resource managers, calling (fn) on each. If (fn) + * returns nonzero, abort the scan and return. + */ +extern int + devinfo_foreach_rman(int (* fn)(struct devinfo_rman *rman, void *arg), + void *arg); + +__END_DECLS + +#endif /* ! _DEVINFO_H_INCLUDED */ diff --git a/src/include.new/devstat.h b/src/include.new/devstat.h new file mode 100644 index 0000000..b9a6723 --- /dev/null +++ b/src/include.new/devstat.h @@ -0,0 +1,168 @@ +/* + * Copyright (c) 1997, 1998 Kenneth D. Merry. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD: src/lib/libdevstat/devstat.h,v 1.10.12.1 2005/07/22 17:29:04 kensmith Exp $ + */ + +#ifndef _DEVSTAT_H +#define _DEVSTAT_H +#include +#include + +#include + +/* + * Bumped every time we change the userland API. Hopefully this doesn't + * happen very often! This should be bumped every time we have to + * increment SHLIB_MAJOR in the libdevstat Makefile (for non-backwards + * compatible API changes) and should also be bumped every time we make + * backwards-compatible API changes, so application writers have a way to + * determine when a particular feature is available. + */ +#define DEVSTAT_USER_API_VER 6 + +#define DEVSTAT_ERRBUF_SIZE 2048 /* size of the devstat library error string */ + +extern char devstat_errbuf[]; + +typedef enum { + DEVSTAT_MATCH_NONE = 0x00, + DEVSTAT_MATCH_TYPE = 0x01, + DEVSTAT_MATCH_IF = 0x02, + DEVSTAT_MATCH_PASS = 0x04 +} devstat_match_flags; + +typedef enum { + DSM_NONE, + DSM_TOTAL_BYTES, + DSM_TOTAL_BYTES_READ, + DSM_TOTAL_BYTES_WRITE, + DSM_TOTAL_TRANSFERS, + DSM_TOTAL_TRANSFERS_READ, + DSM_TOTAL_TRANSFERS_WRITE, + DSM_TOTAL_TRANSFERS_OTHER, + DSM_TOTAL_BLOCKS, + DSM_TOTAL_BLOCKS_READ, + DSM_TOTAL_BLOCKS_WRITE, + DSM_KB_PER_TRANSFER, + DSM_KB_PER_TRANSFER_READ, + DSM_KB_PER_TRANSFER_WRITE, + DSM_TRANSFERS_PER_SECOND, + DSM_TRANSFERS_PER_SECOND_READ, + DSM_TRANSFERS_PER_SECOND_WRITE, + DSM_TRANSFERS_PER_SECOND_OTHER, + DSM_MB_PER_SECOND, + DSM_MB_PER_SECOND_READ, + DSM_MB_PER_SECOND_WRITE, + DSM_BLOCKS_PER_SECOND, + DSM_BLOCKS_PER_SECOND_READ, + DSM_BLOCKS_PER_SECOND_WRITE, + DSM_MS_PER_TRANSACTION, + DSM_MS_PER_TRANSACTION_READ, + DSM_MS_PER_TRANSACTION_WRITE, + DSM_SKIP, + DSM_TOTAL_BYTES_FREE, + DSM_TOTAL_TRANSFERS_FREE, + DSM_TOTAL_BLOCKS_FREE, + DSM_KB_PER_TRANSFER_FREE, + DSM_MB_PER_SECOND_FREE, + DSM_TRANSFERS_PER_SECOND_FREE, + DSM_BLOCKS_PER_SECOND_FREE, + DSM_MS_PER_TRANSACTION_OTHER, + DSM_MS_PER_TRANSACTION_FREE, + DSM_BUSY_PCT, + DSM_QUEUE_LENGTH, + DSM_MAX +} devstat_metric; + +struct devstat_match { + devstat_match_flags match_fields; + devstat_type_flags device_type; + int num_match_categories; +}; + +struct devstat_match_table { + const char * match_str; + devstat_type_flags type; + devstat_match_flags match_field; +}; + +struct device_selection { + u_int32_t device_number; + char device_name[DEVSTAT_NAME_LEN]; + int unit_number; + int selected; + u_int64_t bytes; + int position; +}; + +struct devinfo { + struct devstat *devices; + u_int8_t *mem_ptr; + long generation; + int numdevs; +}; + +struct statinfo { + long cp_time[CPUSTATES]; + long tk_nin; + long tk_nout; + struct devinfo *dinfo; + long double snap_time; +}; + +typedef enum { + DS_SELECT_ADD, + DS_SELECT_ONLY, + DS_SELECT_REMOVE, + DS_SELECT_ADDONLY +} devstat_select_mode; + +__BEGIN_DECLS + +int devstat_getnumdevs(kvm_t *kd); +long devstat_getgeneration(kvm_t *kd); +int devstat_getversion(kvm_t *kd); +int devstat_checkversion(kvm_t *kd); +int devstat_getdevs(kvm_t *kd, struct statinfo *stats); +int devstat_selectdevs(struct device_selection **dev_select, int *num_selected, + int *num_selections, long *select_generation, + long current_generation, struct devstat *devices, + int numdevs, struct devstat_match *matches, + int num_matches, char **dev_selections, + int num_dev_selections, devstat_select_mode select_mode, + int maxshowdevs, int perf_select); +int devstat_buildmatch(char *match_str, struct devstat_match **matches, + int *num_matches); +int devstat_compute_statistics(struct devstat *current, + struct devstat *previous, + long double etime, ...); +long double devstat_compute_etime(struct bintime *cur_time, + struct bintime *prev_time); +__END_DECLS + +#endif /* _DEVSTAT_H */ diff --git a/src/include.new/dialog.h b/src/include.new/dialog.h new file mode 100644 index 0000000..2153431 --- /dev/null +++ b/src/include.new/dialog.h @@ -0,0 +1,211 @@ +#ifndef _DIALOG_H_INCLUDE +#define _DIALOG_H_INCLUDE + +/* + * dialog.h -- common declarations for all dialog modules + * + * AUTHOR: Savio Lam (lam836@cs.cuhk.hk) + * + * Substantial rennovation: 12/18/95, Jordan K. Hubbard + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $FreeBSD: src/gnu/lib/libdialog/dialog.h,v 1.22 2000/12/14 02:35:22 jkh Exp $ + * + */ + +#define HAVE_NCURSES + +#ifdef HAVE_NCURSES +#include + +#else + +#ifdef ultrix +#include +#else +#include +#endif + +#endif + +/* special return codes for `fire' actions */ +#define DITEM_STATUS(flag) ((flag) & 0x0000FFFF) +#define DITEM_SUCCESS 0 +#define DITEM_FAILURE 1 + +/* Flags - returned in upper 16 bits of return status */ +#define DITEM_LEAVE_MENU (1 << 16) +#define DITEM_REDRAW (1 << 17) +#define DITEM_RECREATE (1 << 18) +#define DITEM_RESTORE (1 << 19) +#define DITEM_CONTINUE (1 << 20) + +/* Attributes as used by entry fields right now */ +#define DITEM_NO_ECHO 0x0001 + + +/* negative offsets for buttons in item lists, if specified */ +#define OK_BUTTON -2 +#define CANCEL_BUTTON -1 + +/* for use in describing more exotic behaviors */ +typedef struct _dmenu_item { + char *prompt; + char *title; + int (*checked)(struct _dmenu_item *self); + int (*fire)(struct _dmenu_item *self); + void (*selected)(struct _dmenu_item *self, int is_selected); + void *data; + char lbra, mark, rbra; + long aux; +} dialogMenuItem; + +#define VERSION "0.4" +#define MAX_LEN 2048 + +#ifndef TRUE +#define TRUE (1) +#endif +#ifndef FALSE +#define FALSE (0) +#endif + +extern int DialogX, DialogY, DialogInputAttrs; + +/* + * Attribute names + */ +#define screen_attr attributes[0] +#define shadow_attr attributes[1] +#define dialog_attr attributes[2] +#define title_attr attributes[3] +#define border_attr attributes[4] +#define button_active_attr attributes[5] +#define button_inactive_attr attributes[6] +#define button_key_active_attr attributes[7] +#define button_key_inactive_attr attributes[8] +#define button_label_active_attr attributes[9] +#define button_label_inactive_attr attributes[10] +#define inputbox_attr attributes[11] +#define inputbox_border_attr attributes[12] +#define searchbox_attr attributes[13] +#define searchbox_title_attr attributes[14] +#define searchbox_border_attr attributes[15] +#define position_indicator_attr attributes[16] +#define menubox_attr attributes[17] +#define menubox_border_attr attributes[18] +#define item_attr attributes[19] +#define item_selected_attr attributes[20] +#define tag_attr attributes[21] +#define tag_selected_attr attributes[22] +#define tag_key_attr attributes[23] +#define tag_key_selected_attr attributes[24] +#define check_attr attributes[25] +#define check_selected_attr attributes[26] +#define uarrow_attr attributes[27] +#define darrow_attr attributes[28] + +/* number of attributes */ +#define ATTRIBUTE_COUNT 29 + +extern chtype attributes[]; + +#ifdef HAVE_NCURSES +extern bool use_shadow; +void draw_shadow(WINDOW *win, int y, int x, int height, int width); +#endif +void draw_box(WINDOW *win, int y, int x, int height, int width, chtype box, chtype border); +int line_edit(WINDOW *dialog, int box_y, int box_x, int flen, int box_width, chtype attrs, int first, unsigned char *result, int attr_mask); +int strheight(const char *p); +int strwidth(const char *p); + +void dialog_create_rc(unsigned char *filename); +int dialog_yesno(unsigned char *title, unsigned char *prompt, int height, int width); +int dialog_noyes(unsigned char *title, unsigned char *prompt, int height, int width); +int dialog_prgbox(unsigned char *title, const unsigned char *line, int height, int width, int pause, int use_shell); +int dialog_msgbox(unsigned char *title, unsigned char *prompt, int height, int width, int pause); +int dialog_textbox(unsigned char *title, unsigned char *file, int height, int width); +int dialog_menu(unsigned char *title, unsigned char *prompt, int height, int width, int menu_height, + int item_no, void *itptr, unsigned char *result, int *ch, int *sc); +int dialog_checklist(unsigned char *title, unsigned char *prompt, int height, int width, int list_height, + int item_no, void *itptr, unsigned char *result); +int dialog_radiolist(unsigned char *title, unsigned char *prompt, int height, int width, int list_height, + int item_no, void *itptr, unsigned char *result); +int dialog_inputbox(unsigned char *title, unsigned char *prompt, int height, int width, unsigned char *result); +void dialog_clear_norefresh(void); +void dialog_clear(void); +void dialog_update(void); +void init_dialog(void); +void end_dialog(void); + +/* Additions to libdialog */ +char *dialog_fselect(char *dir, char *fmask); +int dialog_dselect(char *dir, char *fmask); +void dialog_notify(char *msg); +int dialog_mesgbox(unsigned char *title, unsigned char *prompt, int height, int width); +void use_helpfile(char *helpfile); +void use_helpline(char *helpline); +char *get_helpline(void); +void restore_helpline(char *helpline); +void dialog_gauge(char *title, char *prompt, int y, int x, int height, int width, int perc); + +/* + * Display a tree menu from file + * + * filename - file with like find(1) output + * FS - fields separator + * title - title of dialog box + * prompt - prompt text into dialog box + * height - height of dialog box + * width - width of dialog box + * menu_height - height of menu box + * result - pointer to char array + * + * return values: + * -1 - ESC pressed + * 0 - Ok, result set (must be freed later) + * 1 - Cancel + */ +int dialog_ftree(unsigned char *filename, unsigned char FS, + unsigned char *title, unsigned char *prompt, + int height, int width, int menu_height, + unsigned char **result); + +/* + * Display a tree menu from array + * + * names - array with like find(1) output + * size - size of array + * FS - fields separator + * title - title of dialog box + * prompt - prompt text into dialog box + * height - height of dialog box + * width - width of dialog box + * menu_height - height of menu box + * result - pointer to char array + * + * return values: + * -1 - ESC pressed + * 0 - Ok, result set + * 1 - Cancel + */ + +int dialog_tree(unsigned char **names, int size, unsigned char FS, + unsigned char *title, unsigned char *prompt, + int height, int width, int menu_height, + unsigned char **result); + +#endif /* _DIALOG_H_INCLUDE */ diff --git a/src/include.new/dirent.h b/src/include.new/dirent.h new file mode 100644 index 0000000..1d0e1e0 --- /dev/null +++ b/src/include.new/dirent.h @@ -0,0 +1,121 @@ +/*- + * Copyright (c) 1989, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)dirent.h 8.2 (Berkeley) 7/28/94 + * $FreeBSD: src/include/dirent.h,v 1.14 2003/12/07 21:10:06 marcel Exp $ + */ + +#ifndef _DIRENT_H_ +#define _DIRENT_H_ + +/* + * The kernel defines the format of directory entries returned by + * the getdirentries(2) system call. + */ +#include +#include + +#if __BSD_VISIBLE || __XSI_VISIBLE +/* + * XXX this is probably illegal in the __XSI_VISIBLE case, but brings us closer + * to the specification. + */ +#define d_ino d_fileno /* backward and XSI compatibility */ +#endif + +#if __BSD_VISIBLE + +#include + +/* definitions for library routines operating on directories. */ +#define DIRBLKSIZ 1024 + +struct _telldir; /* see telldir.h */ + +/* structure describing an open directory. */ +typedef struct _dirdesc { + int dd_fd; /* file descriptor associated with directory */ + long dd_loc; /* offset in current buffer */ + long dd_size; /* amount of data returned by getdirentries */ + char *dd_buf; /* data buffer */ + int dd_len; /* size of data buffer */ + long dd_seek; /* magic cookie returned by getdirentries */ + long dd_rewind; /* magic cookie for rewinding */ + int dd_flags; /* flags for readdir */ + void *dd_lock; /* hack to avoid including */ + struct _telldir *dd_td; /* telldir position recording */ +} DIR; + +#define dirfd(dirp) ((dirp)->dd_fd) + +/* flags for opendir2 */ +#define DTF_HIDEW 0x0001 /* hide whiteout entries */ +#define DTF_NODUP 0x0002 /* don't return duplicate names */ +#define DTF_REWIND 0x0004 /* rewind after reading union stack */ +#define __DTF_READALL 0x0008 /* everything has been read */ + +#else /* !__BSD_VISIBLE */ + +typedef void * DIR; + +#endif /* __BSD_VISIBLE */ + +#ifndef _KERNEL + +__BEGIN_DECLS +#if __BSD_VISIBLE +DIR *__opendir2(const char *, int); +int alphasort(const void *, const void *); +int getdents(int, char *, int); +int getdirentries(int, char *, int, long *); +#endif +DIR *opendir(const char *); +struct dirent * + readdir(DIR *); +#if __POSIX_VISIBLE >= 199506 || __XSI_VISIBLE >= 500 +int readdir_r(DIR *, struct dirent *, struct dirent **); +#endif +void rewinddir(DIR *); +#if __BSD_VISIBLE +int scandir(const char *, struct dirent ***, + int (*)(struct dirent *), int (*)(const void *, const void *)); +#endif +#if __XSI_VISIBLE +void seekdir(DIR *, long); +long telldir(DIR *); +#endif +int closedir(DIR *); +__END_DECLS + +#endif /* !_KERNEL */ + +#endif /* !_DIRENT_H_ */ diff --git a/src/include.new/dlfcn.h b/src/include.new/dlfcn.h new file mode 100644 index 0000000..581ffcf --- /dev/null +++ b/src/include.new/dlfcn.h @@ -0,0 +1,137 @@ +/*- + * Copyright (c) 1994 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD: src/include/dlfcn.h,v 1.19 2003/02/13 17:47:43 kan Exp $ + */ + +#ifndef _DLFCN_H_ +#define _DLFCN_H_ + +#include + +/* + * Modes and flags for dlopen(). + */ +#define RTLD_LAZY 1 /* Bind function calls lazily. */ +#define RTLD_NOW 2 /* Bind function calls immediately. */ +#define RTLD_MODEMASK 0x3 +#define RTLD_GLOBAL 0x100 /* Make symbols globally available. */ +#define RTLD_LOCAL 0 /* Opposite of RTLD_GLOBAL, and the default. */ +#define RTLD_TRACE 0x200 /* Trace loaded objects and exit. */ + +/* + * Request arguments for dlinfo(). + */ +#define RTLD_DI_LINKMAP 2 /* Obtain link map. */ +#define RTLD_DI_SERINFO 4 /* Obtain search path info. */ +#define RTLD_DI_SERINFOSIZE 5 /* ... query for required space. */ +#define RTLD_DI_ORIGIN 6 /* Obtain object origin */ +#define RTLD_DI_MAX RTLD_DI_ORIGIN + +/* + * Special handle arguments for dlsym()/dlinfo(). + */ +#define RTLD_NEXT ((void *) -1) /* Search subsequent objects. */ +#define RTLD_DEFAULT ((void *) -2) /* Use default search algorithm. */ +#define RTLD_SELF ((void *) -3) /* Search the caller itself. */ + +#if __BSD_VISIBLE + +#ifndef _SIZE_T_DECLARED +typedef __size_t size_t; +#define _SIZE_T_DECLARED +#endif + +/* + * Structure filled in by dladdr(). + */ +typedef struct dl_info { + const char *dli_fname; /* Pathname of shared object. */ + void *dli_fbase; /* Base address of shared object. */ + const char *dli_sname; /* Name of nearest symbol. */ + void *dli_saddr; /* Address of nearest symbol. */ +} Dl_info; + +/*- + * The actual type declared by this typedef is immaterial, provided that + * it is a function pointer. Its purpose is to provide a return type for + * dlfunc() which can be cast to a function pointer type without depending + * on behavior undefined by the C standard, which might trigger a compiler + * diagnostic. We intentionally declare a unique type signature to force + * a diagnostic should the application not cast the return value of dlfunc() + * appropriately. + */ +struct __dlfunc_arg { + int __dlfunc_dummy; +}; + +typedef void (*dlfunc_t)(struct __dlfunc_arg); + +/* + * Structures, returned by the RTLD_DI_SERINFO dlinfo() request. + */ +typedef struct dl_serpath { + char * dls_name; /* single search path entry */ + unsigned int dls_flags; /* path information */ +} Dl_serpath; + +typedef struct dl_serinfo { + size_t dls_size; /* total buffer size */ + unsigned int dls_cnt; /* number of path entries */ + Dl_serpath dls_serpath[1]; /* there may be more than one */ +} Dl_serinfo; + +#endif /* __BSD_VISIBLE */ + +__BEGIN_DECLS +/* XSI functions first. */ +int dlclose(void *); +const char * + dlerror(void); +void *dlopen(const char *, int); +void *dlsym(void * __restrict, const char * __restrict); + +#if __BSD_VISIBLE +int dladdr(const void * __restrict, Dl_info * __restrict); +dlfunc_t dlfunc(void * __restrict, const char * __restrict); +int dlinfo(void * __restrict, int, void * __restrict); +void dllockinit(void *_context, + void *(*_lock_create)(void *_context), + void (*_rlock_acquire)(void *_lock), + void (*_wlock_acquire)(void *_lock), + void (*_lock_release)(void *_lock), + void (*_lock_destroy)(void *_lock), + void (*_context_destroy)(void *_context)); +#endif /* __BSD_VISIBLE */ +__END_DECLS + +#endif /* !_DLFCN_H_ */ diff --git a/src/include.new/elf-hints.h b/src/include.new/elf-hints.h new file mode 100644 index 0000000..d572a4f --- /dev/null +++ b/src/include.new/elf-hints.h @@ -0,0 +1,50 @@ +/*- + * Copyright (c) 1997 John D. Polstra. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD: src/include/elf-hints.h,v 1.4 2001/05/02 23:56:17 obrien Exp $ + */ + +#ifndef _ELF_HINTS_H_ +#define _ELF_HINTS_H_ + +/* + * Hints file produced by ldconfig. + */ +struct elfhints_hdr { + u_int32_t magic; /* Magic number */ + u_int32_t version; /* File version (1) */ + u_int32_t strtab; /* Offset of string table in file */ + u_int32_t strsize; /* Size of string table */ + u_int32_t dirlist; /* Offset of directory list in + string table */ + u_int32_t dirlistlen; /* strlen(dirlist) */ + u_int32_t spare[26]; /* Room for expansion */ +}; + +#define ELFHINTS_MAGIC 0x746e6845 + +#define _PATH_ELF_HINTS "/var/run/ld-elf.so.hints" + +#endif /* !_ELF_HINTS_H_ */ diff --git a/src/include.new/elf.h b/src/include.new/elf.h new file mode 100644 index 0000000..b673187 --- /dev/null +++ b/src/include.new/elf.h @@ -0,0 +1,41 @@ +/*- + * Copyright (c) 2001 David E. O'Brien. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD: src/include/elf.h,v 1.8 2002/07/04 11:05:39 markm Exp $ + */ + +/* + * This is a Solaris compatibility header + */ + +#ifndef _ELF_H_ +#define _ELF_H_ + +#include +#include +#include +#include + +#endif /* !_ELF_H_ */ diff --git a/src/include.new/emmintrin.h b/src/include.new/emmintrin.h new file mode 100644 index 0000000..2869063 --- /dev/null +++ b/src/include.new/emmintrin.h @@ -0,0 +1,1491 @@ +/* Copyright (C) 2003, 2004 Free Software Foundation, Inc. + + This file is part of GCC. + + GCC is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + GCC is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with GCC; see the file COPYING. If not, write to + the Free Software Foundation, 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +/* As a special exception, if you include this header file into source + files compiled by GCC, this header file does not by itself cause + the resulting executable to be covered by the GNU General Public + License. This exception does not however invalidate any other + reasons why the executable file might be covered by the GNU General + Public License. */ + +/* Implemented from the specification included in the Intel C++ Compiler + User Guide and Reference, version 8.0. */ + +#ifndef _EMMINTRIN_H_INCLUDED +#define _EMMINTRIN_H_INCLUDED + +#ifdef __SSE2__ +#include + +/* SSE2 */ +typedef double __v2df __attribute__ ((mode (V2DF))); +typedef int __v2di __attribute__ ((mode (V2DI))); +typedef int __v4si __attribute__ ((mode (V4SI))); +typedef int __v8hi __attribute__ ((mode (V8HI))); +typedef int __v16qi __attribute__ ((mode (V16QI))); + +/* Create a selector for use with the SHUFPD instruction. */ +#define _MM_SHUFFLE2(fp1,fp0) \ + (((fp1) << 1) | (fp0)) + +#define __m128i __v2di +#define __m128d __v2df + +/* Create a vector with element 0 as *P and the rest zero. */ +static __inline __m128d +_mm_load_sd (double const *__P) +{ + return (__m128d) __builtin_ia32_loadsd (__P); +} + +/* Create a vector with all two elements equal to *P. */ +static __inline __m128d +_mm_load1_pd (double const *__P) +{ + __v2df __tmp = __builtin_ia32_loadsd (__P); + return (__m128d) __builtin_ia32_shufpd (__tmp, __tmp, _MM_SHUFFLE2 (0,0)); +} + +static __inline __m128d +_mm_load_pd1 (double const *__P) +{ + return _mm_load1_pd (__P); +} + +/* Load two DPFP values from P. The address must be 16-byte aligned. */ +static __inline __m128d +_mm_load_pd (double const *__P) +{ + return (__m128d) __builtin_ia32_loadapd (__P); +} + +/* Load two DPFP values from P. The address need not be 16-byte aligned. */ +static __inline __m128d +_mm_loadu_pd (double const *__P) +{ + return (__m128d) __builtin_ia32_loadupd (__P); +} + +/* Load two DPFP values in reverse order. The address must be aligned. */ +static __inline __m128d +_mm_loadr_pd (double const *__P) +{ + __v2df __tmp = __builtin_ia32_loadapd (__P); + return (__m128d) __builtin_ia32_shufpd (__tmp, __tmp, _MM_SHUFFLE2 (0,1)); +} + +/* Create a vector with element 0 as F and the rest zero. */ +static __inline __m128d +_mm_set_sd (double __F) +{ + return (__m128d) __builtin_ia32_loadsd (&__F); +} + +/* Create a vector with all two elements equal to F. */ +static __inline __m128d +_mm_set1_pd (double __F) +{ + __v2df __tmp = __builtin_ia32_loadsd (&__F); + return (__m128d) __builtin_ia32_shufpd (__tmp, __tmp, _MM_SHUFFLE2 (0,0)); +} + +static __inline __m128d +_mm_set_pd1 (double __F) +{ + return _mm_set1_pd (__F); +} + +/* Create the vector [Z Y]. */ +static __inline __m128d +_mm_set_pd (double __Z, double __Y) +{ + return (__v2df) {__Y, __Z}; +} + +/* Create the vector [Y Z]. */ +static __inline __m128d +_mm_setr_pd (double __Z, double __Y) +{ + return _mm_set_pd (__Y, __Z); +} + +/* Create a vector of zeros. */ +static __inline __m128d +_mm_setzero_pd (void) +{ + return (__m128d) __builtin_ia32_setzeropd (); +} + +/* Stores the lower DPFP value. */ +static __inline void +_mm_store_sd (double *__P, __m128d __A) +{ + __builtin_ia32_storesd (__P, (__v2df)__A); +} + +/* Store the lower DPFP value across two words. */ +static __inline void +_mm_store1_pd (double *__P, __m128d __A) +{ + __v2df __va = (__v2df)__A; + __v2df __tmp = __builtin_ia32_shufpd (__va, __va, _MM_SHUFFLE2 (0,0)); + __builtin_ia32_storeapd (__P, __tmp); +} + +static __inline void +_mm_store_pd1 (double *__P, __m128d __A) +{ + _mm_store1_pd (__P, __A); +} + +/* Store two DPFP values. The address must be 16-byte aligned. */ +static __inline void +_mm_store_pd (double *__P, __m128d __A) +{ + __builtin_ia32_storeapd (__P, (__v2df)__A); +} + +/* Store two DPFP values. The address need not be 16-byte aligned. */ +static __inline void +_mm_storeu_pd (double *__P, __m128d __A) +{ + __builtin_ia32_storeupd (__P, (__v2df)__A); +} + +/* Store two DPFP values in reverse order. The address must be aligned. */ +static __inline void +_mm_storer_pd (double *__P, __m128d __A) +{ + __v2df __va = (__v2df)__A; + __v2df __tmp = __builtin_ia32_shufpd (__va, __va, _MM_SHUFFLE2 (0,1)); + __builtin_ia32_storeapd (__P, __tmp); +} + +/* Sets the low DPFP value of A from the low value of B. */ +static __inline __m128d +_mm_move_sd (__m128d __A, __m128d __B) +{ + return (__m128d) __builtin_ia32_movsd ((__v2df)__A, (__v2df)__B); +} + + +static __inline __m128d +_mm_add_pd (__m128d __A, __m128d __B) +{ + return (__m128d)__builtin_ia32_addpd ((__v2df)__A, (__v2df)__B); +} + +static __inline __m128d +_mm_add_sd (__m128d __A, __m128d __B) +{ + return (__m128d)__builtin_ia32_addsd ((__v2df)__A, (__v2df)__B); +} + +static __inline __m128d +_mm_sub_pd (__m128d __A, __m128d __B) +{ + return (__m128d)__builtin_ia32_subpd ((__v2df)__A, (__v2df)__B); +} + +static __inline __m128d +_mm_sub_sd (__m128d __A, __m128d __B) +{ + return (__m128d)__builtin_ia32_subsd ((__v2df)__A, (__v2df)__B); +} + +static __inline __m128d +_mm_mul_pd (__m128d __A, __m128d __B) +{ + return (__m128d)__builtin_ia32_mulpd ((__v2df)__A, (__v2df)__B); +} + +static __inline __m128d +_mm_mul_sd (__m128d __A, __m128d __B) +{ + return (__m128d)__builtin_ia32_mulsd ((__v2df)__A, (__v2df)__B); +} + +static __inline __m128d +_mm_div_pd (__m128d __A, __m128d __B) +{ + return (__m128d)__builtin_ia32_divpd ((__v2df)__A, (__v2df)__B); +} + +static __inline __m128d +_mm_div_sd (__m128d __A, __m128d __B) +{ + return (__m128d)__builtin_ia32_divsd ((__v2df)__A, (__v2df)__B); +} + +static __inline __m128d +_mm_sqrt_pd (__m128d __A) +{ + return (__m128d)__builtin_ia32_sqrtpd ((__v2df)__A); +} + +/* Return pair {sqrt (A[0), B[1]}. */ +static __inline __m128d +_mm_sqrt_sd (__m128d __A, __m128d __B) +{ + __v2df __tmp = __builtin_ia32_movsd ((__v2df)__A, (__v2df)__B); + return (__m128d)__builtin_ia32_sqrtsd ((__v2df)__tmp); +} + +static __inline __m128d +_mm_min_pd (__m128d __A, __m128d __B) +{ + return (__m128d)__builtin_ia32_minpd ((__v2df)__A, (__v2df)__B); +} + +static __inline __m128d +_mm_min_sd (__m128d __A, __m128d __B) +{ + return (__m128d)__builtin_ia32_minsd ((__v2df)__A, (__v2df)__B); +} + +static __inline __m128d +_mm_max_pd (__m128d __A, __m128d __B) +{ + return (__m128d)__builtin_ia32_maxpd ((__v2df)__A, (__v2df)__B); +} + +static __inline __m128d +_mm_max_sd (__m128d __A, __m128d __B) +{ + return (__m128d)__builtin_ia32_maxsd ((__v2df)__A, (__v2df)__B); +} + +static __inline __m128d +_mm_and_pd (__m128d __A, __m128d __B) +{ + return (__m128d)__builtin_ia32_andpd ((__v2df)__A, (__v2df)__B); +} + +static __inline __m128d +_mm_andnot_pd (__m128d __A, __m128d __B) +{ + return (__m128d)__builtin_ia32_andnpd ((__v2df)__A, (__v2df)__B); +} + +static __inline __m128d +_mm_or_pd (__m128d __A, __m128d __B) +{ + return (__m128d)__builtin_ia32_orpd ((__v2df)__A, (__v2df)__B); +} + +static __inline __m128d +_mm_xor_pd (__m128d __A, __m128d __B) +{ + return (__m128d)__builtin_ia32_xorpd ((__v2df)__A, (__v2df)__B); +} + +static __inline __m128d +_mm_cmpeq_pd (__m128d __A, __m128d __B) +{ + return (__m128d)__builtin_ia32_cmpeqpd ((__v2df)__A, (__v2df)__B); +} + +static __inline __m128d +_mm_cmplt_pd (__m128d __A, __m128d __B) +{ + return (__m128d)__builtin_ia32_cmpltpd ((__v2df)__A, (__v2df)__B); +} + +static __inline __m128d +_mm_cmple_pd (__m128d __A, __m128d __B) +{ + return (__m128d)__builtin_ia32_cmplepd ((__v2df)__A, (__v2df)__B); +} + +static __inline __m128d +_mm_cmpgt_pd (__m128d __A, __m128d __B) +{ + return (__m128d)__builtin_ia32_cmpgtpd ((__v2df)__A, (__v2df)__B); +} + +static __inline __m128d +_mm_cmpge_pd (__m128d __A, __m128d __B) +{ + return (__m128d)__builtin_ia32_cmpgepd ((__v2df)__A, (__v2df)__B); +} + +static __inline __m128d +_mm_cmpneq_pd (__m128d __A, __m128d __B) +{ + return (__m128d)__builtin_ia32_cmpneqpd ((__v2df)__A, (__v2df)__B); +} + +static __inline __m128d +_mm_cmpnlt_pd (__m128d __A, __m128d __B) +{ + return (__m128d)__builtin_ia32_cmpnltpd ((__v2df)__A, (__v2df)__B); +} + +static __inline __m128d +_mm_cmpnle_pd (__m128d __A, __m128d __B) +{ + return (__m128d)__builtin_ia32_cmpnlepd ((__v2df)__A, (__v2df)__B); +} + +static __inline __m128d +_mm_cmpngt_pd (__m128d __A, __m128d __B) +{ + return (__m128d)__builtin_ia32_cmpngtpd ((__v2df)__A, (__v2df)__B); +} + +static __inline __m128d +_mm_cmpnge_pd (__m128d __A, __m128d __B) +{ + return (__m128d)__builtin_ia32_cmpngepd ((__v2df)__A, (__v2df)__B); +} + +static __inline __m128d +_mm_cmpord_pd (__m128d __A, __m128d __B) +{ + return (__m128d)__builtin_ia32_cmpordpd ((__v2df)__A, (__v2df)__B); +} + +static __inline __m128d +_mm_cmpunord_pd (__m128d __A, __m128d __B) +{ + return (__m128d)__builtin_ia32_cmpunordpd ((__v2df)__A, (__v2df)__B); +} + +static __inline __m128d +_mm_cmpeq_sd (__m128d __A, __m128d __B) +{ + return (__m128d)__builtin_ia32_cmpeqsd ((__v2df)__A, (__v2df)__B); +} + +static __inline __m128d +_mm_cmplt_sd (__m128d __A, __m128d __B) +{ + return (__m128d)__builtin_ia32_cmpltsd ((__v2df)__A, (__v2df)__B); +} + +static __inline __m128d +_mm_cmple_sd (__m128d __A, __m128d __B) +{ + return (__m128d)__builtin_ia32_cmplesd ((__v2df)__A, (__v2df)__B); +} + +static __inline __m128d +_mm_cmpgt_sd (__m128d __A, __m128d __B) +{ + return (__m128d) __builtin_ia32_movsd ((__v2df) __A, + (__v2df) + __builtin_ia32_cmpltsd ((__v2df) __B, + (__v2df) + __A)); +} + +static __inline __m128d +_mm_cmpge_sd (__m128d __A, __m128d __B) +{ + return (__m128d) __builtin_ia32_movsd ((__v2df) __A, + (__v2df) + __builtin_ia32_cmplesd ((__v2df) __B, + (__v2df) + __A)); +} + +static __inline __m128d +_mm_cmpneq_sd (__m128d __A, __m128d __B) +{ + return (__m128d)__builtin_ia32_cmpneqsd ((__v2df)__A, (__v2df)__B); +} + +static __inline __m128d +_mm_cmpnlt_sd (__m128d __A, __m128d __B) +{ + return (__m128d)__builtin_ia32_cmpnltsd ((__v2df)__A, (__v2df)__B); +} + +static __inline __m128d +_mm_cmpnle_sd (__m128d __A, __m128d __B) +{ + return (__m128d)__builtin_ia32_cmpnlesd ((__v2df)__A, (__v2df)__B); +} + +static __inline __m128d +_mm_cmpngt_sd (__m128d __A, __m128d __B) +{ + return (__m128d) __builtin_ia32_movsd ((__v2df) __A, + (__v2df) + __builtin_ia32_cmpnltsd ((__v2df) __B, + (__v2df) + __A)); +} + +static __inline __m128d +_mm_cmpnge_sd (__m128d __A, __m128d __B) +{ + return (__m128d) __builtin_ia32_movsd ((__v2df) __A, + (__v2df) + __builtin_ia32_cmpnlesd ((__v2df) __B, + (__v2df) + __A)); +} + +static __inline __m128d +_mm_cmpord_sd (__m128d __A, __m128d __B) +{ + return (__m128d)__builtin_ia32_cmpordsd ((__v2df)__A, (__v2df)__B); +} + +static __inline __m128d +_mm_cmpunord_sd (__m128d __A, __m128d __B) +{ + return (__m128d)__builtin_ia32_cmpunordsd ((__v2df)__A, (__v2df)__B); +} + +static __inline int +_mm_comieq_sd (__m128d __A, __m128d __B) +{ + return __builtin_ia32_comisdeq ((__v2df)__A, (__v2df)__B); +} + +static __inline int +_mm_comilt_sd (__m128d __A, __m128d __B) +{ + return __builtin_ia32_comisdlt ((__v2df)__A, (__v2df)__B); +} + +static __inline int +_mm_comile_sd (__m128d __A, __m128d __B) +{ + return __builtin_ia32_comisdle ((__v2df)__A, (__v2df)__B); +} + +static __inline int +_mm_comigt_sd (__m128d __A, __m128d __B) +{ + return __builtin_ia32_comisdgt ((__v2df)__A, (__v2df)__B); +} + +static __inline int +_mm_comige_sd (__m128d __A, __m128d __B) +{ + return __builtin_ia32_comisdge ((__v2df)__A, (__v2df)__B); +} + +static __inline int +_mm_comineq_sd (__m128d __A, __m128d __B) +{ + return __builtin_ia32_comisdneq ((__v2df)__A, (__v2df)__B); +} + +static __inline int +_mm_ucomieq_sd (__m128d __A, __m128d __B) +{ + return __builtin_ia32_ucomisdeq ((__v2df)__A, (__v2df)__B); +} + +static __inline int +_mm_ucomilt_sd (__m128d __A, __m128d __B) +{ + return __builtin_ia32_ucomisdlt ((__v2df)__A, (__v2df)__B); +} + +static __inline int +_mm_ucomile_sd (__m128d __A, __m128d __B) +{ + return __builtin_ia32_ucomisdle ((__v2df)__A, (__v2df)__B); +} + +static __inline int +_mm_ucomigt_sd (__m128d __A, __m128d __B) +{ + return __builtin_ia32_ucomisdgt ((__v2df)__A, (__v2df)__B); +} + +static __inline int +_mm_ucomige_sd (__m128d __A, __m128d __B) +{ + return __builtin_ia32_ucomisdge ((__v2df)__A, (__v2df)__B); +} + +static __inline int +_mm_ucomineq_sd (__m128d __A, __m128d __B) +{ + return __builtin_ia32_ucomisdneq ((__v2df)__A, (__v2df)__B); +} + +/* Create a vector with element 0 as *P and the rest zero. */ + +static __inline __m128i +_mm_load_si128 (__m128i const *__P) +{ + return (__m128i) __builtin_ia32_loaddqa ((char const *)__P); +} + +static __inline __m128i +_mm_loadu_si128 (__m128i const *__P) +{ + return (__m128i) __builtin_ia32_loaddqu ((char const *)__P); +} + +static __inline __m128i +_mm_loadl_epi64 (__m128i const *__P) +{ + return (__m128i) __builtin_ia32_movq2dq (*(unsigned long long *)__P); +} + +static __inline void +_mm_store_si128 (__m128i *__P, __m128i __B) +{ + __builtin_ia32_storedqa ((char *)__P, (__v16qi)__B); +} + +static __inline void +_mm_storeu_si128 (__m128i *__P, __m128i __B) +{ + __builtin_ia32_storedqu ((char *)__P, (__v16qi)__B); +} + +static __inline void +_mm_storel_epi64 (__m128i *__P, __m128i __B) +{ + *(long long *)__P = __builtin_ia32_movdq2q ((__v2di)__B); +} + +static __inline __m64 +_mm_movepi64_pi64 (__m128i __B) +{ + return (__m64) __builtin_ia32_movdq2q ((__v2di)__B); +} + +static __inline __m128i +_mm_move_epi64 (__m128i __A) +{ + return (__m128i) __builtin_ia32_movq ((__v2di)__A); +} + +/* Create a vector of zeros. */ +static __inline __m128i +_mm_setzero_si128 (void) +{ + return (__m128i) __builtin_ia32_setzero128 (); +} + +static __inline __m128i +_mm_set_epi64 (__m64 __A, __m64 __B) +{ + __v2di __tmp = (__v2di)__builtin_ia32_movq2dq ((unsigned long long)__A); + __v2di __tmp2 = (__v2di)__builtin_ia32_movq2dq ((unsigned long long)__B); + return (__m128i)__builtin_ia32_punpcklqdq128 (__tmp2, __tmp); +} + +/* Create the vector [Z Y X W]. */ +static __inline __m128i +_mm_set_epi32 (int __Z, int __Y, int __X, int __W) +{ + union { + int __a[4]; + __m128i __v; + } __u; + + __u.__a[0] = __W; + __u.__a[1] = __X; + __u.__a[2] = __Y; + __u.__a[3] = __Z; + + return __u.__v; +} + +#ifdef __x86_64__ +/* Create the vector [Z Y]. */ +static __inline __m128i +_mm_set_epi64x (long long __Z, long long __Y) +{ + union { + long __a[2]; + __m128i __v; + } __u; + + __u.__a[0] = __Y; + __u.__a[1] = __Z; + + return __u.__v; +} +#endif + +/* Create the vector [S T U V Z Y X W]. */ +static __inline __m128i +_mm_set_epi16 (short __Z, short __Y, short __X, short __W, + short __V, short __U, short __T, short __S) +{ + union { + short __a[8]; + __m128i __v; + } __u; + + __u.__a[0] = __S; + __u.__a[1] = __T; + __u.__a[2] = __U; + __u.__a[3] = __V; + __u.__a[4] = __W; + __u.__a[5] = __X; + __u.__a[6] = __Y; + __u.__a[7] = __Z; + + return __u.__v; +} + +/* Create the vector [S T U V Z Y X W]. */ +static __inline __m128i +_mm_set_epi8 (char __Z, char __Y, char __X, char __W, + char __V, char __U, char __T, char __S, + char __Z1, char __Y1, char __X1, char __W1, + char __V1, char __U1, char __T1, char __S1) +{ + union { + char __a[16]; + __m128i __v; + } __u; + + __u.__a[0] = __S1; + __u.__a[1] = __T1; + __u.__a[2] = __U1; + __u.__a[3] = __V1; + __u.__a[4] = __W1; + __u.__a[5] = __X1; + __u.__a[6] = __Y1; + __u.__a[7] = __Z1; + __u.__a[8] = __S; + __u.__a[9] = __T; + __u.__a[10] = __U; + __u.__a[11] = __V; + __u.__a[12] = __W; + __u.__a[13] = __X; + __u.__a[14] = __Y; + __u.__a[15] = __Z; + + return __u.__v; +} + +static __inline __m128i +_mm_set1_epi64 (__m64 __A) +{ + __v2di __tmp = (__v2di)__builtin_ia32_movq2dq ((unsigned long long)__A); + return (__m128i)__builtin_ia32_punpcklqdq128 (__tmp, __tmp); +} + +static __inline __m128i +_mm_set1_epi32 (int __A) +{ + __v4si __tmp = (__v4si)__builtin_ia32_loadd (&__A); + return (__m128i) __builtin_ia32_pshufd ((__v4si)__tmp, _MM_SHUFFLE (0,0,0,0)); +} + +#ifdef __x86_64__ +static __inline __m128i +_mm_set1_epi64x (long long __A) +{ + __v2di __tmp = (__v2di)__builtin_ia32_movq2dq ((unsigned long long)__A); + return (__m128i) __builtin_ia32_shufpd ((__v2df)__tmp, (__v2df)__tmp, _MM_SHUFFLE2 (0,0)); +} +#endif + +static __inline __m128i +_mm_set1_epi16 (short __A) +{ + int __Acopy = (unsigned short)__A; + __v4si __tmp = (__v4si)__builtin_ia32_loadd (&__Acopy); + __tmp = (__v4si)__builtin_ia32_punpcklwd128 ((__v8hi)__tmp, (__v8hi)__tmp); + return (__m128i) __builtin_ia32_pshufd ((__v4si)__tmp, _MM_SHUFFLE (0,0,0,0)); +} + +static __inline __m128i +_mm_set1_epi8 (char __A) +{ + int __Acopy = (unsigned char)__A; + __v4si __tmp = (__v4si)__builtin_ia32_loadd (&__Acopy); + __tmp = (__v4si)__builtin_ia32_punpcklbw128 ((__v16qi)__tmp, (__v16qi)__tmp); + __tmp = (__v4si)__builtin_ia32_punpcklbw128 ((__v16qi)__tmp, (__v16qi)__tmp); + return (__m128i) __builtin_ia32_pshufd ((__v4si)__tmp, _MM_SHUFFLE (0,0,0,0)); +} + +static __inline __m128i +_mm_setr_epi64 (__m64 __A, __m64 __B) +{ + __v2di __tmp = (__v2di)__builtin_ia32_movq2dq ((unsigned long long)__A); + __v2di __tmp2 = (__v2di)__builtin_ia32_movq2dq ((unsigned long long)__B); + return (__m128i)__builtin_ia32_punpcklqdq128 (__tmp, __tmp2); +} + +/* Create the vector [Z Y X W]. */ +static __inline __m128i +_mm_setr_epi32 (int __W, int __X, int __Y, int __Z) +{ + union { + int __a[4]; + __m128i __v; + } __u; + + __u.__a[0] = __W; + __u.__a[1] = __X; + __u.__a[2] = __Y; + __u.__a[3] = __Z; + + return __u.__v; +} +/* Create the vector [S T U V Z Y X W]. */ +static __inline __m128i +_mm_setr_epi16 (short __S, short __T, short __U, short __V, + short __W, short __X, short __Y, short __Z) +{ + union { + short __a[8]; + __m128i __v; + } __u; + + __u.__a[0] = __S; + __u.__a[1] = __T; + __u.__a[2] = __U; + __u.__a[3] = __V; + __u.__a[4] = __W; + __u.__a[5] = __X; + __u.__a[6] = __Y; + __u.__a[7] = __Z; + + return __u.__v; +} + +/* Create the vector [S T U V Z Y X W]. */ +static __inline __m128i +_mm_setr_epi8 (char __S1, char __T1, char __U1, char __V1, + char __W1, char __X1, char __Y1, char __Z1, + char __S, char __T, char __U, char __V, + char __W, char __X, char __Y, char __Z) +{ + union { + char __a[16]; + __m128i __v; + } __u; + + __u.__a[0] = __S1; + __u.__a[1] = __T1; + __u.__a[2] = __U1; + __u.__a[3] = __V1; + __u.__a[4] = __W1; + __u.__a[5] = __X1; + __u.__a[6] = __Y1; + __u.__a[7] = __Z1; + __u.__a[8] = __S; + __u.__a[9] = __T; + __u.__a[10] = __U; + __u.__a[11] = __V; + __u.__a[12] = __W; + __u.__a[13] = __X; + __u.__a[14] = __Y; + __u.__a[15] = __Z; + + return __u.__v; +} + +static __inline __m128d +_mm_cvtepi32_pd (__m128i __A) +{ + return (__m128d)__builtin_ia32_cvtdq2pd ((__v4si) __A); +} + +static __inline __m128 +_mm_cvtepi32_ps (__m128i __A) +{ + return (__m128)__builtin_ia32_cvtdq2ps ((__v4si) __A); +} + +static __inline __m128i +_mm_cvtpd_epi32 (__m128d __A) +{ + return (__m128i)__builtin_ia32_cvtpd2dq ((__v2df) __A); +} + +static __inline __m64 +_mm_cvtpd_pi32 (__m128d __A) +{ + return (__m64)__builtin_ia32_cvtpd2pi ((__v2df) __A); +} + +static __inline __m128 +_mm_cvtpd_ps (__m128d __A) +{ + return (__m128)__builtin_ia32_cvtpd2ps ((__v2df) __A); +} + +static __inline __m128i +_mm_cvttpd_epi32 (__m128d __A) +{ + return (__m128i)__builtin_ia32_cvttpd2dq ((__v2df) __A); +} + +static __inline __m64 +_mm_cvttpd_pi32 (__m128d __A) +{ + return (__m64)__builtin_ia32_cvttpd2pi ((__v2df) __A); +} + +static __inline __m128d +_mm_cvtpi32_pd (__m64 __A) +{ + return (__m128d)__builtin_ia32_cvtpi2pd ((__v2si) __A); +} + +static __inline __m128i +_mm_cvtps_epi32 (__m128 __A) +{ + return (__m128i)__builtin_ia32_cvtps2dq ((__v4sf) __A); +} + +static __inline __m128i +_mm_cvttps_epi32 (__m128 __A) +{ + return (__m128i)__builtin_ia32_cvttps2dq ((__v4sf) __A); +} + +static __inline __m128d +_mm_cvtps_pd (__m128 __A) +{ + return (__m128d)__builtin_ia32_cvtps2pd ((__v4sf) __A); +} + +static __inline int +_mm_cvtsd_si32 (__m128d __A) +{ + return __builtin_ia32_cvtsd2si ((__v2df) __A); +} + +#ifdef __x86_64__ +static __inline long long +_mm_cvtsd_si64x (__m128d __A) +{ + return __builtin_ia32_cvtsd2si64 ((__v2df) __A); +} +#endif + +static __inline int +_mm_cvttsd_si32 (__m128d __A) +{ + return __builtin_ia32_cvttsd2si ((__v2df) __A); +} + +#ifdef __x86_64__ +static __inline long long +_mm_cvttsd_si64x (__m128d __A) +{ + return __builtin_ia32_cvttsd2si64 ((__v2df) __A); +} +#endif + +static __inline __m128 +_mm_cvtsd_ss (__m128 __A, __m128d __B) +{ + return (__m128)__builtin_ia32_cvtsd2ss ((__v4sf) __A, (__v2df) __B); +} + +static __inline __m128d +_mm_cvtsi32_sd (__m128d __A, int __B) +{ + return (__m128d)__builtin_ia32_cvtsi2sd ((__v2df) __A, __B); +} + +#ifdef __x86_64__ +static __inline __m128d +_mm_cvtsi64x_sd (__m128d __A, long long __B) +{ + return (__m128d)__builtin_ia32_cvtsi642sd ((__v2df) __A, __B); +} +#endif + +static __inline __m128d +_mm_cvtss_sd (__m128d __A, __m128 __B) +{ + return (__m128d)__builtin_ia32_cvtss2sd ((__v2df) __A, (__v4sf)__B); +} + +#define _mm_shuffle_pd(__A, __B, __C) ((__m128d)__builtin_ia32_shufpd ((__v2df)__A, (__v2df)__B, (__C))) + +static __inline __m128d +_mm_unpackhi_pd (__m128d __A, __m128d __B) +{ + return (__m128d)__builtin_ia32_unpckhpd ((__v2df)__A, (__v2df)__B); +} + +static __inline __m128d +_mm_unpacklo_pd (__m128d __A, __m128d __B) +{ + return (__m128d)__builtin_ia32_unpcklpd ((__v2df)__A, (__v2df)__B); +} + +static __inline __m128d +_mm_loadh_pd (__m128d __A, double const *__B) +{ + return (__m128d)__builtin_ia32_loadhpd ((__v2df)__A, (__v2si *)__B); +} + +static __inline void +_mm_storeh_pd (double *__A, __m128d __B) +{ + __builtin_ia32_storehpd ((__v2si *)__A, (__v2df)__B); +} + +static __inline __m128d +_mm_loadl_pd (__m128d __A, double const *__B) +{ + return (__m128d)__builtin_ia32_loadlpd ((__v2df)__A, (__v2si *)__B); +} + +static __inline void +_mm_storel_pd (double *__A, __m128d __B) +{ + __builtin_ia32_storelpd ((__v2si *)__A, (__v2df)__B); +} + +static __inline int +_mm_movemask_pd (__m128d __A) +{ + return __builtin_ia32_movmskpd ((__v2df)__A); +} + +static __inline __m128i +_mm_packs_epi16 (__m128i __A, __m128i __B) +{ + return (__m128i)__builtin_ia32_packsswb128 ((__v8hi)__A, (__v8hi)__B); +} + +static __inline __m128i +_mm_packs_epi32 (__m128i __A, __m128i __B) +{ + return (__m128i)__builtin_ia32_packssdw128 ((__v4si)__A, (__v4si)__B); +} + +static __inline __m128i +_mm_packus_epi16 (__m128i __A, __m128i __B) +{ + return (__m128i)__builtin_ia32_packuswb128 ((__v8hi)__A, (__v8hi)__B); +} + +static __inline __m128i +_mm_unpackhi_epi8 (__m128i __A, __m128i __B) +{ + return (__m128i)__builtin_ia32_punpckhbw128 ((__v16qi)__A, (__v16qi)__B); +} + +static __inline __m128i +_mm_unpackhi_epi16 (__m128i __A, __m128i __B) +{ + return (__m128i)__builtin_ia32_punpckhwd128 ((__v8hi)__A, (__v8hi)__B); +} + +static __inline __m128i +_mm_unpackhi_epi32 (__m128i __A, __m128i __B) +{ + return (__m128i)__builtin_ia32_punpckhdq128 ((__v4si)__A, (__v4si)__B); +} + +static __inline __m128i +_mm_unpackhi_epi64 (__m128i __A, __m128i __B) +{ + return (__m128i)__builtin_ia32_punpckhqdq128 ((__v2di)__A, (__v2di)__B); +} + +static __inline __m128i +_mm_unpacklo_epi8 (__m128i __A, __m128i __B) +{ + return (__m128i)__builtin_ia32_punpcklbw128 ((__v16qi)__A, (__v16qi)__B); +} + +static __inline __m128i +_mm_unpacklo_epi16 (__m128i __A, __m128i __B) +{ + return (__m128i)__builtin_ia32_punpcklwd128 ((__v8hi)__A, (__v8hi)__B); +} + +static __inline __m128i +_mm_unpacklo_epi32 (__m128i __A, __m128i __B) +{ + return (__m128i)__builtin_ia32_punpckldq128 ((__v4si)__A, (__v4si)__B); +} + +static __inline __m128i +_mm_unpacklo_epi64 (__m128i __A, __m128i __B) +{ + return (__m128i)__builtin_ia32_punpcklqdq128 ((__v2di)__A, (__v2di)__B); +} + +static __inline __m128i +_mm_add_epi8 (__m128i __A, __m128i __B) +{ + return (__m128i)__builtin_ia32_paddb128 ((__v16qi)__A, (__v16qi)__B); +} + +static __inline __m128i +_mm_add_epi16 (__m128i __A, __m128i __B) +{ + return (__m128i)__builtin_ia32_paddw128 ((__v8hi)__A, (__v8hi)__B); +} + +static __inline __m128i +_mm_add_epi32 (__m128i __A, __m128i __B) +{ + return (__m128i)__builtin_ia32_paddd128 ((__v4si)__A, (__v4si)__B); +} + +static __inline __m128i +_mm_add_epi64 (__m128i __A, __m128i __B) +{ + return (__m128i)__builtin_ia32_paddq128 ((__v2di)__A, (__v2di)__B); +} + +static __inline __m128i +_mm_adds_epi8 (__m128i __A, __m128i __B) +{ + return (__m128i)__builtin_ia32_paddsb128 ((__v16qi)__A, (__v16qi)__B); +} + +static __inline __m128i +_mm_adds_epi16 (__m128i __A, __m128i __B) +{ + return (__m128i)__builtin_ia32_paddsw128 ((__v8hi)__A, (__v8hi)__B); +} + +static __inline __m128i +_mm_adds_epu8 (__m128i __A, __m128i __B) +{ + return (__m128i)__builtin_ia32_paddusb128 ((__v16qi)__A, (__v16qi)__B); +} + +static __inline __m128i +_mm_adds_epu16 (__m128i __A, __m128i __B) +{ + return (__m128i)__builtin_ia32_paddusw128 ((__v8hi)__A, (__v8hi)__B); +} + +static __inline __m128i +_mm_sub_epi8 (__m128i __A, __m128i __B) +{ + return (__m128i)__builtin_ia32_psubb128 ((__v16qi)__A, (__v16qi)__B); +} + +static __inline __m128i +_mm_sub_epi16 (__m128i __A, __m128i __B) +{ + return (__m128i)__builtin_ia32_psubw128 ((__v8hi)__A, (__v8hi)__B); +} + +static __inline __m128i +_mm_sub_epi32 (__m128i __A, __m128i __B) +{ + return (__m128i)__builtin_ia32_psubd128 ((__v4si)__A, (__v4si)__B); +} + +static __inline __m128i +_mm_sub_epi64 (__m128i __A, __m128i __B) +{ + return (__m128i)__builtin_ia32_psubq128 ((__v2di)__A, (__v2di)__B); +} + +static __inline __m128i +_mm_subs_epi8 (__m128i __A, __m128i __B) +{ + return (__m128i)__builtin_ia32_psubsb128 ((__v16qi)__A, (__v16qi)__B); +} + +static __inline __m128i +_mm_subs_epi16 (__m128i __A, __m128i __B) +{ + return (__m128i)__builtin_ia32_psubsw128 ((__v8hi)__A, (__v8hi)__B); +} + +static __inline __m128i +_mm_subs_epu8 (__m128i __A, __m128i __B) +{ + return (__m128i)__builtin_ia32_psubusb128 ((__v16qi)__A, (__v16qi)__B); +} + +static __inline __m128i +_mm_subs_epu16 (__m128i __A, __m128i __B) +{ + return (__m128i)__builtin_ia32_psubusw128 ((__v8hi)__A, (__v8hi)__B); +} + +static __inline __m128i +_mm_madd_epi16 (__m128i __A, __m128i __B) +{ + return (__m128i)__builtin_ia32_pmaddwd128 ((__v8hi)__A, (__v8hi)__B); +} + +static __inline __m128i +_mm_mulhi_epi16 (__m128i __A, __m128i __B) +{ + return (__m128i)__builtin_ia32_pmulhw128 ((__v8hi)__A, (__v8hi)__B); +} + +static __inline __m128i +_mm_mullo_epi16 (__m128i __A, __m128i __B) +{ + return (__m128i)__builtin_ia32_pmullw128 ((__v8hi)__A, (__v8hi)__B); +} + +static __inline __m64 +_mm_mul_su32 (__m64 __A, __m64 __B) +{ + return (__m64)__builtin_ia32_pmuludq ((__v2si)__A, (__v2si)__B); +} + +static __inline __m128i +_mm_mul_epu32 (__m128i __A, __m128i __B) +{ + return (__m128i)__builtin_ia32_pmuludq128 ((__v4si)__A, (__v4si)__B); +} + +static __inline __m128i +_mm_sll_epi16 (__m128i __A, __m128i __B) +{ + return (__m128i)__builtin_ia32_psllw128 ((__v8hi)__A, (__v2di)__B); +} + +static __inline __m128i +_mm_sll_epi32 (__m128i __A, __m128i __B) +{ + return (__m128i)__builtin_ia32_pslld128 ((__v4si)__A, (__v2di)__B); +} + +static __inline __m128i +_mm_sll_epi64 (__m128i __A, __m128i __B) +{ + return (__m128i)__builtin_ia32_psllq128 ((__v2di)__A, (__v2di)__B); +} + +static __inline __m128i +_mm_sra_epi16 (__m128i __A, __m128i __B) +{ + return (__m128i)__builtin_ia32_psraw128 ((__v8hi)__A, (__v2di)__B); +} + +static __inline __m128i +_mm_sra_epi32 (__m128i __A, __m128i __B) +{ + return (__m128i)__builtin_ia32_psrad128 ((__v4si)__A, (__v2di)__B); +} + +static __inline __m128i +_mm_srl_epi16 (__m128i __A, __m128i __B) +{ + return (__m128i)__builtin_ia32_psrlw128 ((__v8hi)__A, (__v2di)__B); +} + +static __inline __m128i +_mm_srl_epi32 (__m128i __A, __m128i __B) +{ + return (__m128i)__builtin_ia32_psrld128 ((__v4si)__A, (__v2di)__B); +} + +static __inline __m128i +_mm_srl_epi64 (__m128i __A, __m128i __B) +{ + return (__m128i)__builtin_ia32_psrlq128 ((__v2di)__A, (__v2di)__B); +} + +static __inline __m128i +_mm_slli_epi16 (__m128i __A, int __B) +{ + return (__m128i)__builtin_ia32_psllwi128 ((__v8hi)__A, __B); +} + +static __inline __m128i +_mm_slli_epi32 (__m128i __A, int __B) +{ + return (__m128i)__builtin_ia32_pslldi128 ((__v4si)__A, __B); +} + +static __inline __m128i +_mm_slli_epi64 (__m128i __A, int __B) +{ + return (__m128i)__builtin_ia32_psllqi128 ((__v2di)__A, __B); +} + +static __inline __m128i +_mm_srai_epi16 (__m128i __A, int __B) +{ + return (__m128i)__builtin_ia32_psrawi128 ((__v8hi)__A, __B); +} + +static __inline __m128i +_mm_srai_epi32 (__m128i __A, int __B) +{ + return (__m128i)__builtin_ia32_psradi128 ((__v4si)__A, __B); +} + +#if 0 +static __m128i __attribute__((__always_inline__)) +_mm_srli_si128 (__m128i __A, const int __B) +{ + return ((__m128i)__builtin_ia32_psrldqi128 (__A, __B)) +} + +static __m128i __attribute__((__always_inline__)) +_mm_srli_si128 (__m128i __A, const int __B) +{ + return ((__m128i)__builtin_ia32_pslldqi128 (__A, __B)) +} +#endif +#define _mm_srli_si128(__A, __B) ((__m128i)__builtin_ia32_psrldqi128 (__A, __B)) +#define _mm_slli_si128(__A, __B) ((__m128i)__builtin_ia32_pslldqi128 (__A, __B)) + +static __inline __m128i +_mm_srli_epi16 (__m128i __A, int __B) +{ + return (__m128i)__builtin_ia32_psrlwi128 ((__v8hi)__A, __B); +} + +static __inline __m128i +_mm_srli_epi32 (__m128i __A, int __B) +{ + return (__m128i)__builtin_ia32_psrldi128 ((__v4si)__A, __B); +} + +static __inline __m128i +_mm_srli_epi64 (__m128i __A, int __B) +{ + return (__m128i)__builtin_ia32_psrlqi128 ((__v2di)__A, __B); +} + +static __inline __m128i +_mm_and_si128 (__m128i __A, __m128i __B) +{ + return (__m128i)__builtin_ia32_pand128 ((__v2di)__A, (__v2di)__B); +} + +static __inline __m128i +_mm_andnot_si128 (__m128i __A, __m128i __B) +{ + return (__m128i)__builtin_ia32_pandn128 ((__v2di)__A, (__v2di)__B); +} + +static __inline __m128i +_mm_or_si128 (__m128i __A, __m128i __B) +{ + return (__m128i)__builtin_ia32_por128 ((__v2di)__A, (__v2di)__B); +} + +static __inline __m128i +_mm_xor_si128 (__m128i __A, __m128i __B) +{ + return (__m128i)__builtin_ia32_pxor128 ((__v2di)__A, (__v2di)__B); +} + +static __inline __m128i +_mm_cmpeq_epi8 (__m128i __A, __m128i __B) +{ + return (__m128i)__builtin_ia32_pcmpeqb128 ((__v16qi)__A, (__v16qi)__B); +} + +static __inline __m128i +_mm_cmpeq_epi16 (__m128i __A, __m128i __B) +{ + return (__m128i)__builtin_ia32_pcmpeqw128 ((__v8hi)__A, (__v8hi)__B); +} + +static __inline __m128i +_mm_cmpeq_epi32 (__m128i __A, __m128i __B) +{ + return (__m128i)__builtin_ia32_pcmpeqd128 ((__v4si)__A, (__v4si)__B); +} + +static __inline __m128i +_mm_cmplt_epi8 (__m128i __A, __m128i __B) +{ + return (__m128i)__builtin_ia32_pcmpgtb128 ((__v16qi)__B, (__v16qi)__A); +} + +static __inline __m128i +_mm_cmplt_epi16 (__m128i __A, __m128i __B) +{ + return (__m128i)__builtin_ia32_pcmpgtw128 ((__v8hi)__B, (__v8hi)__A); +} + +static __inline __m128i +_mm_cmplt_epi32 (__m128i __A, __m128i __B) +{ + return (__m128i)__builtin_ia32_pcmpgtd128 ((__v4si)__B, (__v4si)__A); +} + +static __inline __m128i +_mm_cmpgt_epi8 (__m128i __A, __m128i __B) +{ + return (__m128i)__builtin_ia32_pcmpgtb128 ((__v16qi)__A, (__v16qi)__B); +} + +static __inline __m128i +_mm_cmpgt_epi16 (__m128i __A, __m128i __B) +{ + return (__m128i)__builtin_ia32_pcmpgtw128 ((__v8hi)__A, (__v8hi)__B); +} + +static __inline __m128i +_mm_cmpgt_epi32 (__m128i __A, __m128i __B) +{ + return (__m128i)__builtin_ia32_pcmpgtd128 ((__v4si)__A, (__v4si)__B); +} + +#define _mm_extract_epi16(__A, __B) __builtin_ia32_pextrw128 ((__v8hi)__A, __B) + +#define _mm_insert_epi16(__A, __B, __C) ((__m128i)__builtin_ia32_pinsrw128 ((__v8hi)__A, __B, __C)) + +static __inline __m128i +_mm_max_epi16 (__m128i __A, __m128i __B) +{ + return (__m128i)__builtin_ia32_pmaxsw128 ((__v8hi)__A, (__v8hi)__B); +} + +static __inline __m128i +_mm_max_epu8 (__m128i __A, __m128i __B) +{ + return (__m128i)__builtin_ia32_pmaxub128 ((__v16qi)__A, (__v16qi)__B); +} + +static __inline __m128i +_mm_min_epi16 (__m128i __A, __m128i __B) +{ + return (__m128i)__builtin_ia32_pminsw128 ((__v8hi)__A, (__v8hi)__B); +} + +static __inline __m128i +_mm_min_epu8 (__m128i __A, __m128i __B) +{ + return (__m128i)__builtin_ia32_pminub128 ((__v16qi)__A, (__v16qi)__B); +} + +static __inline int +_mm_movemask_epi8 (__m128i __A) +{ + return __builtin_ia32_pmovmskb128 ((__v16qi)__A); +} + +static __inline __m128i +_mm_mulhi_epu16 (__m128i __A, __m128i __B) +{ + return (__m128i)__builtin_ia32_pmulhuw128 ((__v8hi)__A, (__v8hi)__B); +} + +#define _mm_shufflehi_epi16(__A, __B) ((__m128i)__builtin_ia32_pshufhw ((__v8hi)__A, __B)) +#define _mm_shufflelo_epi16(__A, __B) ((__m128i)__builtin_ia32_pshuflw ((__v8hi)__A, __B)) +#define _mm_shuffle_epi32(__A, __B) ((__m128i)__builtin_ia32_pshufd ((__v4si)__A, __B)) + +static __inline void +_mm_maskmoveu_si128 (__m128i __A, __m128i __B, char *__C) +{ + __builtin_ia32_maskmovdqu ((__v16qi)__A, (__v16qi)__B, __C); +} + +static __inline __m128i +_mm_avg_epu8 (__m128i __A, __m128i __B) +{ + return (__m128i)__builtin_ia32_pavgb128 ((__v16qi)__A, (__v16qi)__B); +} + +static __inline __m128i +_mm_avg_epu16 (__m128i __A, __m128i __B) +{ + return (__m128i)__builtin_ia32_pavgw128 ((__v8hi)__A, (__v8hi)__B); +} + +static __inline __m128i +_mm_sad_epu8 (__m128i __A, __m128i __B) +{ + return (__m128i)__builtin_ia32_psadbw128 ((__v16qi)__A, (__v16qi)__B); +} + +static __inline void +_mm_stream_si32 (int *__A, int __B) +{ + __builtin_ia32_movnti (__A, __B); +} + +static __inline void +_mm_stream_si128 (__m128i *__A, __m128i __B) +{ + __builtin_ia32_movntdq ((__v2di *)__A, (__v2di)__B); +} + +static __inline void +_mm_stream_pd (double *__A, __m128d __B) +{ + __builtin_ia32_movntpd (__A, (__v2df)__B); +} + +static __inline __m128i +_mm_movpi64_epi64 (__m64 __A) +{ + return (__m128i)__builtin_ia32_movq2dq ((unsigned long long)__A); +} + +static __inline void +_mm_clflush (void const *__A) +{ + return __builtin_ia32_clflush (__A); +} + +static __inline void +_mm_lfence (void) +{ + __builtin_ia32_lfence (); +} + +static __inline void +_mm_mfence (void) +{ + __builtin_ia32_mfence (); +} + +static __inline __m128i +_mm_cvtsi32_si128 (int __A) +{ + return (__m128i) __builtin_ia32_loadd (&__A); +} + +#ifdef __x86_64__ +static __inline __m128i +_mm_cvtsi64x_si128 (long long __A) +{ + return (__m128i) __builtin_ia32_movq2dq (__A); +} +#endif + +static __inline int +_mm_cvtsi128_si32 (__m128i __A) +{ + int __tmp; + __builtin_ia32_stored (&__tmp, (__v4si)__A); + return __tmp; +} + +#ifdef __x86_64__ +static __inline long long +_mm_cvtsi128_si64x (__m128i __A) +{ + return __builtin_ia32_movdq2q ((__v2di)__A); +} +#endif + +#endif /* __SSE2__ */ + +#endif /* _EMMINTRIN_H_INCLUDED */ diff --git a/src/include.new/err.h b/src/include.new/err.h new file mode 100644 index 0000000..a3c04cf --- /dev/null +++ b/src/include.new/err.h @@ -0,0 +1,68 @@ +/*- + * Copyright (c) 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)err.h 8.1 (Berkeley) 6/2/93 + * $FreeBSD: src/include/err.h,v 1.11 2002/08/21 16:19:55 mike Exp $ + */ + +#ifndef _ERR_H_ +#define _ERR_H_ + +/* + * Don't use va_list in the err/warn prototypes. Va_list is typedef'd in two + * places ( and ), so if we include one + * of them here we may collide with the utility's includes. It's unreasonable + * for utilities to have to include one of them to include err.h, so we get + * __va_list from and use it. + */ +#include +#include + +__BEGIN_DECLS +void err(int, const char *, ...) __dead2 __printf0like(2, 3); +void verr(int, const char *, __va_list) __dead2 __printf0like(2, 0); +void errc(int, int, const char *, ...) __dead2 __printf0like(3, 4); +void verrc(int, int, const char *, __va_list) __dead2 + __printf0like(3, 0); +void errx(int, const char *, ...) __dead2 __printf0like(2, 3); +void verrx(int, const char *, __va_list) __dead2 __printf0like(2, 0); +void warn(const char *, ...) __printf0like(1, 2); +void vwarn(const char *, __va_list) __printf0like(1, 0); +void warnc(int, const char *, ...) __printf0like(2, 3); +void vwarnc(int, const char *, __va_list) __printf0like(2, 0); +void warnx(const char *, ...) __printflike(1, 2); +void vwarnx(const char *, __va_list) __printflike(1, 0); +void err_set_file(void *); +void err_set_exit(void (*)(int)); +__END_DECLS + +#endif /* !_ERR_H_ */ diff --git a/src/include.new/errno.h b/src/include.new/errno.h new file mode 100644 index 0000000..87146c5 --- /dev/null +++ b/src/include.new/errno.h @@ -0,0 +1,188 @@ +/*- + * Copyright (c) 1982, 1986, 1989, 1993 + * The Regents of the University of California. All rights reserved. + * (c) UNIX System Laboratories, Inc. + * All or some portions of this file are derived from material licensed + * to the University of California by American Telephone and Telegraph + * Co. or Unix System Laboratories, Inc. and are reproduced herein with + * the permission of UNIX System Laboratories, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)errno.h 8.5 (Berkeley) 1/21/94 + * $FreeBSD: src/sys/sys/errno.h,v 1.28 2005/04/02 12:33:28 das Exp $ + */ + +#ifndef _SYS_ERRNO_H_ +#define _SYS_ERRNO_H_ + +#ifndef _KERNEL +#include +__BEGIN_DECLS +int * __error(void); +__END_DECLS +#define errno (* __error()) +#endif + +#define EPERM 1 /* Operation not permitted */ +#define ENOENT 2 /* No such file or directory */ +#define ESRCH 3 /* No such process */ +#define EINTR 4 /* Interrupted system call */ +#define EIO 5 /* Input/output error */ +#define ENXIO 6 /* Device not configured */ +#define E2BIG 7 /* Argument list too long */ +#define ENOEXEC 8 /* Exec format error */ +#define EBADF 9 /* Bad file descriptor */ +#define ECHILD 10 /* No child processes */ +#define EDEADLK 11 /* Resource deadlock avoided */ + /* 11 was EAGAIN */ +#define ENOMEM 12 /* Cannot allocate memory */ +#define EACCES 13 /* Permission denied */ +#define EFAULT 14 /* Bad address */ +#ifndef _POSIX_SOURCE +#define ENOTBLK 15 /* Block device required */ +#endif +#define EBUSY 16 /* Device busy */ +#define EEXIST 17 /* File exists */ +#define EXDEV 18 /* Cross-device link */ +#define ENODEV 19 /* Operation not supported by device */ +#define ENOTDIR 20 /* Not a directory */ +#define EISDIR 21 /* Is a directory */ +#define EINVAL 22 /* Invalid argument */ +#define ENFILE 23 /* Too many open files in system */ +#define EMFILE 24 /* Too many open files */ +#define ENOTTY 25 /* Inappropriate ioctl for device */ +#ifndef _POSIX_SOURCE +#define ETXTBSY 26 /* Text file busy */ +#endif +#define EFBIG 27 /* File too large */ +#define ENOSPC 28 /* No space left on device */ +#define ESPIPE 29 /* Illegal seek */ +#define EROFS 30 /* Read-only filesystem */ +#define EMLINK 31 /* Too many links */ +#define EPIPE 32 /* Broken pipe */ + +/* math software */ +#define EDOM 33 /* Numerical argument out of domain */ +#define ERANGE 34 /* Result too large */ + +/* non-blocking and interrupt i/o */ +#define EAGAIN 35 /* Resource temporarily unavailable */ +#ifndef _POSIX_SOURCE +#define EWOULDBLOCK EAGAIN /* Operation would block */ +#define EINPROGRESS 36 /* Operation now in progress */ +#define EALREADY 37 /* Operation already in progress */ + +/* ipc/network software -- argument errors */ +#define ENOTSOCK 38 /* Socket operation on non-socket */ +#define EDESTADDRREQ 39 /* Destination address required */ +#define EMSGSIZE 40 /* Message too long */ +#define EPROTOTYPE 41 /* Protocol wrong type for socket */ +#define ENOPROTOOPT 42 /* Protocol not available */ +#define EPROTONOSUPPORT 43 /* Protocol not supported */ +#define ESOCKTNOSUPPORT 44 /* Socket type not supported */ +#define EOPNOTSUPP 45 /* Operation not supported */ +#define ENOTSUP EOPNOTSUPP /* Operation not supported */ +#define EPFNOSUPPORT 46 /* Protocol family not supported */ +#define EAFNOSUPPORT 47 /* Address family not supported by protocol family */ +#define EADDRINUSE 48 /* Address already in use */ +#define EADDRNOTAVAIL 49 /* Can't assign requested address */ + +/* ipc/network software -- operational errors */ +#define ENETDOWN 50 /* Network is down */ +#define ENETUNREACH 51 /* Network is unreachable */ +#define ENETRESET 52 /* Network dropped connection on reset */ +#define ECONNABORTED 53 /* Software caused connection abort */ +#define ECONNRESET 54 /* Connection reset by peer */ +#define ENOBUFS 55 /* No buffer space available */ +#define EISCONN 56 /* Socket is already connected */ +#define ENOTCONN 57 /* Socket is not connected */ +#define ESHUTDOWN 58 /* Can't send after socket shutdown */ +#define ETOOMANYREFS 59 /* Too many references: can't splice */ +#define ETIMEDOUT 60 /* Operation timed out */ +#define ECONNREFUSED 61 /* Connection refused */ + +#define ELOOP 62 /* Too many levels of symbolic links */ +#endif /* _POSIX_SOURCE */ +#define ENAMETOOLONG 63 /* File name too long */ + +/* should be rearranged */ +#ifndef _POSIX_SOURCE +#define EHOSTDOWN 64 /* Host is down */ +#define EHOSTUNREACH 65 /* No route to host */ +#endif /* _POSIX_SOURCE */ +#define ENOTEMPTY 66 /* Directory not empty */ + +/* quotas & mush */ +#ifndef _POSIX_SOURCE +#define EPROCLIM 67 /* Too many processes */ +#define EUSERS 68 /* Too many users */ +#define EDQUOT 69 /* Disc quota exceeded */ + +/* Network File System */ +#define ESTALE 70 /* Stale NFS file handle */ +#define EREMOTE 71 /* Too many levels of remote in path */ +#define EBADRPC 72 /* RPC struct is bad */ +#define ERPCMISMATCH 73 /* RPC version wrong */ +#define EPROGUNAVAIL 74 /* RPC prog. not avail */ +#define EPROGMISMATCH 75 /* Program version wrong */ +#define EPROCUNAVAIL 76 /* Bad procedure for program */ +#endif /* _POSIX_SOURCE */ + +#define ENOLCK 77 /* No locks available */ +#define ENOSYS 78 /* Function not implemented */ + +#ifndef _POSIX_SOURCE +#define EFTYPE 79 /* Inappropriate file type or format */ +#define EAUTH 80 /* Authentication error */ +#define ENEEDAUTH 81 /* Need authenticator */ +#define EIDRM 82 /* Identifier removed */ +#define ENOMSG 83 /* No message of desired type */ +#define EOVERFLOW 84 /* Value too large to be stored in data type */ +#define ECANCELED 85 /* Operation canceled */ +#define EILSEQ 86 /* Illegal byte sequence */ +#define ENOATTR 87 /* Attribute not found */ + +#define EDOOFUS 88 /* Programming error */ +#endif /* _POSIX_SOURCE */ + +#define EBADMSG 89 /* Bad message */ +#define EMULTIHOP 90 /* Multihop attempted */ +#define ENOLINK 91 /* Link has been severed */ +#define EPROTO 92 /* Protocol error */ + +#ifndef _POSIX_SOURCE +#define ELAST 92 /* Must be equal largest errno */ +#endif /* _POSIX_SOURCE */ + +#ifdef _KERNEL +/* pseudo-errors returned inside kernel to modify return to process */ +#define ERESTART (-1) /* restart syscall */ +#define EJUSTRETURN (-2) /* don't modify regs, just return */ +#define ENOIOCTL (-3) /* ioctl not handled by this layer */ +#define EDIRIOCTL (-4) /* do direct ioctl in GEOM */ +#endif + +#endif diff --git a/src/include.new/eti.h b/src/include.new/eti.h new file mode 100644 index 0000000..4561fa4 --- /dev/null +++ b/src/include.new/eti.h @@ -0,0 +1,52 @@ +/**************************************************************************** + * Copyright (c) 1998 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Juergen Pfeifer 1995,1997 * + ****************************************************************************/ + +#ifndef NCURSES_ETI_H_incl +#define NCURSES_ETI_H_incl 1 + +#define E_OK (0) +#define E_SYSTEM_ERROR (-1) +#define E_BAD_ARGUMENT (-2) +#define E_POSTED (-3) +#define E_CONNECTED (-4) +#define E_BAD_STATE (-5) +#define E_NO_ROOM (-6) +#define E_NOT_POSTED (-7) +#define E_UNKNOWN_COMMAND (-8) +#define E_NO_MATCH (-9) +#define E_NOT_SELECTABLE (-10) +#define E_NOT_CONNECTED (-11) +#define E_REQUEST_DENIED (-12) +#define E_INVALID_FIELD (-13) +#define E_CURRENT (-14) + +#endif diff --git a/src/include.new/fcntl.h b/src/include.new/fcntl.h new file mode 100644 index 0000000..2fb656e --- /dev/null +++ b/src/include.new/fcntl.h @@ -0,0 +1,229 @@ +/*- + * Copyright (c) 1983, 1990, 1993 + * The Regents of the University of California. All rights reserved. + * (c) UNIX System Laboratories, Inc. + * All or some portions of this file are derived from material licensed + * to the University of California by American Telephone and Telegraph + * Co. or Unix System Laboratories, Inc. and are reproduced herein with + * the permission of UNIX System Laboratories, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)fcntl.h 8.3 (Berkeley) 1/21/94 + * $FreeBSD: src/sys/sys/fcntl.h,v 1.16 2004/04/07 04:19:49 imp Exp $ + */ + +#ifndef _SYS_FCNTL_H_ +#define _SYS_FCNTL_H_ + +/* + * This file includes the definitions for open and fcntl + * described by POSIX for ; it also includes + * related kernel definitions. + */ + +#include +#include + +#ifndef _MODE_T_DECLARED +typedef __mode_t mode_t; +#define _MODE_T_DECLARED +#endif + +#ifndef _OFF_T_DECLARED +typedef __off_t off_t; +#define _OFF_T_DECLARED +#endif + +#ifndef _PID_T_DECLARED +typedef __pid_t pid_t; +#define _PID_T_DECLARED +#endif + +/* + * File status flags: these are used by open(2), fcntl(2). + * They are also used (indirectly) in the kernel file structure f_flags, + * which is a superset of the open/fcntl flags. Open flags and f_flags + * are inter-convertible using OFLAGS(fflags) and FFLAGS(oflags). + * Open/fcntl flags begin with O_; kernel-internal flags begin with F. + */ +/* open-only flags */ +#define O_RDONLY 0x0000 /* open for reading only */ +#define O_WRONLY 0x0001 /* open for writing only */ +#define O_RDWR 0x0002 /* open for reading and writing */ +#define O_ACCMODE 0x0003 /* mask for above modes */ + +/* + * Kernel encoding of open mode; separate read and write bits that are + * independently testable: 1 greater than the above. + * + * XXX + * FREAD and FWRITE are excluded from the #ifdef _KERNEL so that TIOCFLUSH, + * which was documented to use FREAD/FWRITE, continues to work. + */ +#if __BSD_VISIBLE +#define FREAD 0x0001 +#define FWRITE 0x0002 +#endif +#define O_NONBLOCK 0x0004 /* no delay */ +#define O_APPEND 0x0008 /* set append mode */ +#if __BSD_VISIBLE +#define O_SHLOCK 0x0010 /* open with shared file lock */ +#define O_EXLOCK 0x0020 /* open with exclusive file lock */ +#define O_ASYNC 0x0040 /* signal pgrp when data ready */ +#define O_FSYNC 0x0080 /* synchronous writes */ +#endif +#define O_SYNC 0x0080 /* POSIX synonym for O_FSYNC */ +#if __BSD_VISIBLE +#define O_NOFOLLOW 0x0100 /* don't follow symlinks */ +#endif +#define O_CREAT 0x0200 /* create if nonexistent */ +#define O_TRUNC 0x0400 /* truncate to zero length */ +#define O_EXCL 0x0800 /* error if already exists */ +#ifdef _KERNEL +#define FHASLOCK 0x4000 /* descriptor holds advisory lock */ +#endif + +/* Defined by POSIX 1003.1; BSD default, but must be distinct from O_RDONLY. */ +#define O_NOCTTY 0x8000 /* don't assign controlling terminal */ + +#if __BSD_VISIBLE +/* Attempt to bypass buffer cache */ +#define O_DIRECT 0x00010000 +#endif + +/* + * XXX missing O_DSYNC, O_RSYNC. + */ + +#ifdef _KERNEL +/* convert from open() flags to/from fflags; convert O_RD/WR to FREAD/FWRITE */ +#define FFLAGS(oflags) ((oflags) + 1) +#define OFLAGS(fflags) ((fflags) - 1) + +/* bits to save after open */ +#define FMASK (FREAD|FWRITE|FAPPEND|FASYNC|FFSYNC|FNONBLOCK|O_DIRECT) +/* bits settable by fcntl(F_SETFL, ...) */ +#define FCNTLFLAGS (FAPPEND|FASYNC|FFSYNC|FNONBLOCK|FPOSIXSHM|O_DIRECT) +#endif + +/* + * The O_* flags used to have only F* names, which were used in the kernel + * and by fcntl. We retain the F* names for the kernel f_flag field + * and for backward compatibility for fcntl. These flags are deprecated. + */ +#if __BSD_VISIBLE +#define FAPPEND O_APPEND /* kernel/compat */ +#define FASYNC O_ASYNC /* kernel/compat */ +#define FFSYNC O_FSYNC /* kernel */ +#define FNONBLOCK O_NONBLOCK /* kernel */ +#define FNDELAY O_NONBLOCK /* compat */ +#define O_NDELAY O_NONBLOCK /* compat */ +#endif + +/* + * We are out of bits in f_flag (which is a short). However, + * the flag bits not set in FMASK are only meaningful in the + * initial open syscall. Those bits can thus be given a + * different meaning for fcntl(2). + */ +#if __BSD_VISIBLE + +/* + * Set by shm_open(3) to get automatic MAP_ASYNC behavior + * for POSIX shared memory objects (which are otherwise + * implemented as plain files). + */ +#define FPOSIXSHM O_NOFOLLOW +#endif + +/* + * Constants used for fcntl(2) + */ + +/* command values */ +#define F_DUPFD 0 /* duplicate file descriptor */ +#define F_GETFD 1 /* get file descriptor flags */ +#define F_SETFD 2 /* set file descriptor flags */ +#define F_GETFL 3 /* get file status flags */ +#define F_SETFL 4 /* set file status flags */ +#if __BSD_VISIBLE || __XSI_VISIBLE || __POSIX_VISIBLE >= 200112 +#define F_GETOWN 5 /* get SIGIO/SIGURG proc/pgrp */ +#define F_SETOWN 6 /* set SIGIO/SIGURG proc/pgrp */ +#endif +#define F_GETLK 7 /* get record locking information */ +#define F_SETLK 8 /* set record locking information */ +#define F_SETLKW 9 /* F_SETLK; wait if blocked */ + +/* file descriptor flags (F_GETFD, F_SETFD) */ +#define FD_CLOEXEC 1 /* close-on-exec flag */ + +/* record locking flags (F_GETLK, F_SETLK, F_SETLKW) */ +#define F_RDLCK 1 /* shared or read lock */ +#define F_UNLCK 2 /* unlock */ +#define F_WRLCK 3 /* exclusive or write lock */ +#ifdef _KERNEL +#define F_WAIT 0x010 /* Wait until lock is granted */ +#define F_FLOCK 0x020 /* Use flock(2) semantics for lock */ +#define F_POSIX 0x040 /* Use POSIX semantics for lock */ +#endif + +/* + * Advisory file segment locking data type - + * information passed to system by user + */ +struct flock { + off_t l_start; /* starting offset */ + off_t l_len; /* len = 0 means until end of file */ + pid_t l_pid; /* lock owner */ + short l_type; /* lock type: read/write, etc. */ + short l_whence; /* type of l_start */ +}; + + +#if __BSD_VISIBLE +/* lock operations for flock(2) */ +#define LOCK_SH 0x01 /* shared file lock */ +#define LOCK_EX 0x02 /* exclusive file lock */ +#define LOCK_NB 0x04 /* don't block when locking */ +#define LOCK_UN 0x08 /* unlock file */ +#endif + +/* + * XXX missing posix_fadvise() and posix_fallocate(), and POSIX_FADV_* macros. + */ + +#ifndef _KERNEL +__BEGIN_DECLS +int open(const char *, int, ...); +int creat(const char *, mode_t); +int fcntl(int, int, ...); +#if __BSD_VISIBLE +int flock(int, int); +#endif +__END_DECLS +#endif + +#endif /* !_SYS_FCNTL_H_ */ diff --git a/src/include.new/fenv.h b/src/include.new/fenv.h new file mode 100644 index 0000000..b124366 --- /dev/null +++ b/src/include.new/fenv.h @@ -0,0 +1,240 @@ +/*- + * Copyright (c) 2004-2005 David Schultz + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD: src/lib/msun/i387/fenv.h,v 1.4 2005/03/17 22:21:46 das Exp $ + */ + +#ifndef _FENV_H_ +#define _FENV_H_ + +#include +#include + +/* + * To preserve binary compatibility with FreeBSD 5.3, we pack the + * mxcsr into some reserved fields, rather than changing sizeof(fenv_t). + */ +typedef struct { + __uint16_t __control; + __uint16_t __mxcsr_hi; + __uint16_t __status; + __uint16_t __mxcsr_lo; + __uint32_t __tag; + char __other[16]; +} fenv_t; + +#define __get_mxcsr(env) (((env).__mxcsr_hi << 16) | \ + ((env).__mxcsr_lo)) +#define __set_mxcsr(env, x) do { \ + (env).__mxcsr_hi = (__uint32_t)(x) >> 16; \ + (env).__mxcsr_lo = (__uint16_t)(x); \ +} while (0) + +typedef __uint16_t fexcept_t; + +/* Exception flags */ +#define FE_INVALID 0x01 +#define FE_DENORMAL 0x02 +#define FE_DIVBYZERO 0x04 +#define FE_OVERFLOW 0x08 +#define FE_UNDERFLOW 0x10 +#define FE_INEXACT 0x20 +#define FE_ALL_EXCEPT (FE_DIVBYZERO | FE_DENORMAL | FE_INEXACT | \ + FE_INVALID | FE_OVERFLOW | FE_UNDERFLOW) + +/* Rounding modes */ +#define FE_TONEAREST 0x0000 +#define FE_DOWNWARD 0x0400 +#define FE_UPWARD 0x0800 +#define FE_TOWARDZERO 0x0c00 +#define _ROUND_MASK (FE_TONEAREST | FE_DOWNWARD | \ + FE_UPWARD | FE_TOWARDZERO) + +/* + * As compared to the x87 control word, the SSE unit's control word + * has the rounding control bits offset by 3 and the exception mask + * bits offset by 7. + */ +#define _SSE_ROUND_SHIFT 3 +#define _SSE_EMASK_SHIFT 7 + +/* After testing for SSE support once, we cache the result in __has_sse. */ +enum __sse_support { __SSE_YES, __SSE_NO, __SSE_UNK }; +extern enum __sse_support __has_sse; +int __test_sse(void); +#ifdef __SSE__ +#define __HAS_SSE() 1 +#else +#define __HAS_SSE() (__has_sse == __SSE_YES || \ + (__has_sse == __SSE_UNK && __test_sse())) +#endif + +__BEGIN_DECLS + +/* Default floating-point environment */ +extern const fenv_t __fe_dfl_env; +#define FE_DFL_ENV (&__fe_dfl_env) + +#define __fldcw(__cw) __asm __volatile("fldcw %0" : : "m" (__cw)) +#define __fldenv(__env) __asm __volatile("fldenv %0" : : "m" (__env)) +#define __fnclex() __asm __volatile("fnclex") +#define __fnstenv(__env) __asm __volatile("fnstenv %0" : "=m" (*(__env))) +#define __fnstcw(__cw) __asm __volatile("fnstcw %0" : "=m" (*(__cw))) +#define __fnstsw(__sw) __asm __volatile("fnstsw %0" : "=am" (*(__sw))) +#define __fwait() __asm __volatile("fwait") +#define __ldmxcsr(__csr) __asm __volatile("ldmxcsr %0" : : "m" (__csr)) +#define __stmxcsr(__csr) __asm __volatile("stmxcsr %0" : "=m" (*(__csr))) + +static __inline int +feclearexcept(int __excepts) +{ + fenv_t __env; + int __mxcsr; + + if (__excepts == FE_ALL_EXCEPT) { + __fnclex(); + } else { + __fnstenv(&__env); + __env.__status &= ~__excepts; + __fldenv(__env); + } + if (__HAS_SSE()) { + __stmxcsr(&__mxcsr); + __mxcsr &= ~__excepts; + __ldmxcsr(__mxcsr); + } + return (0); +} + +static __inline int +fegetexceptflag(fexcept_t *__flagp, int __excepts) +{ + int __mxcsr, __status; + + __fnstsw(&__status); + if (__HAS_SSE()) + __stmxcsr(&__mxcsr); + else + __mxcsr = 0; + *__flagp = (__mxcsr | __status) & __excepts; + return (0); +} + +int fesetexceptflag(const fexcept_t *__flagp, int __excepts); +int feraiseexcept(int __excepts); + +static __inline int +fetestexcept(int __excepts) +{ + int __mxcsr, __status; + + __fnstsw(&__status); + if (__HAS_SSE()) + __stmxcsr(&__mxcsr); + else + __mxcsr = 0; + return ((__status | __mxcsr) & __excepts); +} + +static __inline int +fegetround(void) +{ + int __control; + + /* + * We assume that the x87 and the SSE unit agree on the + * rounding mode. Reading the control word on the x87 turns + * out to be about 5 times faster than reading it on the SSE + * unit on an Opteron 244. + */ + __fnstcw(&__control); + return (__control & _ROUND_MASK); +} + +static __inline int +fesetround(int __round) +{ + int __mxcsr, __control; + + if (__round & ~_ROUND_MASK) + return (-1); + + __fnstcw(&__control); + __control &= ~_ROUND_MASK; + __control |= __round; + __fldcw(__control); + + if (__HAS_SSE()) { + __stmxcsr(&__mxcsr); + __mxcsr &= ~(_ROUND_MASK << _SSE_ROUND_SHIFT); + __mxcsr |= __round << _SSE_ROUND_SHIFT; + __ldmxcsr(__mxcsr); + } + + return (0); +} + +int fegetenv(fenv_t *__envp); +int feholdexcept(fenv_t *__envp); + +static __inline int +fesetenv(const fenv_t *__envp) +{ + fenv_t __env = *__envp; + int __mxcsr; + + __mxcsr = __get_mxcsr(__env); + __set_mxcsr(__env, 0xffffffff); + __fldenv(__env); + if (__HAS_SSE()) + __ldmxcsr(__mxcsr); + return (0); +} + +int feupdateenv(const fenv_t *__envp); + +#if __BSD_VISIBLE + +int feenableexcept(int __mask); +int fedisableexcept(int __mask); + +static __inline int +fegetexcept(void) +{ + int __control; + + /* + * We assume that the masks for the x87 and the SSE unit are + * the same. + */ + __fnstcw(&__control); + return (~__control & FE_ALL_EXCEPT); +} + +#endif /* __BSD_VISIBLE */ + +__END_DECLS + +#endif /* !_FENV_H_ */ diff --git a/src/include.new/fetch.h b/src/include.new/fetch.h new file mode 100644 index 0000000..e820f96 --- /dev/null +++ b/src/include.new/fetch.h @@ -0,0 +1,150 @@ +/*- + * Copyright (c) 1998-2004 Dag-Erling Co�dan Sm�rgrav + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer + * in this position and unchanged. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * $FreeBSD: src/lib/libfetch/fetch.h,v 1.26 2004/09/21 18:35:20 des Exp $ + */ + +#ifndef _FETCH_H_INCLUDED +#define _FETCH_H_INCLUDED + +#define _LIBFETCH_VER "libfetch/2.0" + +#define URL_SCHEMELEN 16 +#define URL_USERLEN 256 +#define URL_PWDLEN 256 + +struct url { + char scheme[URL_SCHEMELEN+1]; + char user[URL_USERLEN+1]; + char pwd[URL_PWDLEN+1]; + char host[MAXHOSTNAMELEN+1]; + int port; + char *doc; + off_t offset; + size_t length; +}; + +struct url_stat { + off_t size; + time_t atime; + time_t mtime; +}; + +struct url_ent { + char name[PATH_MAX]; + struct url_stat stat; +}; + +/* Recognized schemes */ +#define SCHEME_FTP "ftp" +#define SCHEME_HTTP "http" +#define SCHEME_HTTPS "https" +#define SCHEME_FILE "file" + +/* Error codes */ +#define FETCH_ABORT 1 +#define FETCH_AUTH 2 +#define FETCH_DOWN 3 +#define FETCH_EXISTS 4 +#define FETCH_FULL 5 +#define FETCH_INFO 6 +#define FETCH_MEMORY 7 +#define FETCH_MOVED 8 +#define FETCH_NETWORK 9 +#define FETCH_OK 10 +#define FETCH_PROTO 11 +#define FETCH_RESOLV 12 +#define FETCH_SERVER 13 +#define FETCH_TEMP 14 +#define FETCH_TIMEOUT 15 +#define FETCH_UNAVAIL 16 +#define FETCH_UNKNOWN 17 +#define FETCH_URL 18 +#define FETCH_VERBOSE 19 + +__BEGIN_DECLS + +/* FILE-specific functions */ +FILE *fetchXGetFile(struct url *, struct url_stat *, const char *); +FILE *fetchGetFile(struct url *, const char *); +FILE *fetchPutFile(struct url *, const char *); +int fetchStatFile(struct url *, struct url_stat *, const char *); +struct url_ent *fetchListFile(struct url *, const char *); + +/* HTTP-specific functions */ +FILE *fetchXGetHTTP(struct url *, struct url_stat *, const char *); +FILE *fetchGetHTTP(struct url *, const char *); +FILE *fetchPutHTTP(struct url *, const char *); +int fetchStatHTTP(struct url *, struct url_stat *, const char *); +struct url_ent *fetchListHTTP(struct url *, const char *); + +/* FTP-specific functions */ +FILE *fetchXGetFTP(struct url *, struct url_stat *, const char *); +FILE *fetchGetFTP(struct url *, const char *); +FILE *fetchPutFTP(struct url *, const char *); +int fetchStatFTP(struct url *, struct url_stat *, const char *); +struct url_ent *fetchListFTP(struct url *, const char *); + +/* Generic functions */ +FILE *fetchXGetURL(const char *, struct url_stat *, const char *); +FILE *fetchGetURL(const char *, const char *); +FILE *fetchPutURL(const char *, const char *); +int fetchStatURL(const char *, struct url_stat *, const char *); +struct url_ent *fetchListURL(const char *, const char *); +FILE *fetchXGet(struct url *, struct url_stat *, const char *); +FILE *fetchGet(struct url *, const char *); +FILE *fetchPut(struct url *, const char *); +int fetchStat(struct url *, struct url_stat *, const char *); +struct url_ent *fetchList(struct url *, const char *); + +/* URL parsing */ +struct url *fetchMakeURL(const char *, const char *, int, + const char *, const char *, const char *); +struct url *fetchParseURL(const char *); +void fetchFreeURL(struct url *); + +__END_DECLS + +/* Authentication */ +typedef int (*auth_t)(struct url *); +extern auth_t fetchAuthMethod; + +/* Last error code */ +extern int fetchLastErrCode; +#define MAXERRSTRING 256 +extern char fetchLastErrString[MAXERRSTRING]; + +/* I/O timeout */ +extern int fetchTimeout; + +/* Restart interrupted syscalls */ +extern int fetchRestartCalls; + +/* Extra verbosity */ +extern int fetchDebug; + +#endif diff --git a/src/include.new/float.h b/src/include.new/float.h new file mode 100644 index 0000000..bafe449 --- /dev/null +++ b/src/include.new/float.h @@ -0,0 +1,78 @@ +/*- + * Copyright (c) 1989 Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * from: @(#)float.h 7.1 (Berkeley) 5/8/90 + * $FreeBSD: src/sys/i386/include/float.h,v 1.15 2005/01/06 22:18:15 imp Exp $ + */ + +#ifndef _MACHINE_FLOAT_H_ +#define _MACHINE_FLOAT_H_ 1 + +#include + +__BEGIN_DECLS +extern int __flt_rounds(void); +__END_DECLS + +#define FLT_RADIX 2 /* b */ +#define FLT_ROUNDS __flt_rounds() +#if __ISO_C_VISIBLE >= 1999 +#define FLT_EVAL_METHOD (-1) /* i387 semantics are...interesting */ +#define DECIMAL_DIG 21 /* max precision in decimal digits */ +#endif + +#define FLT_MANT_DIG 24 /* p */ +#define FLT_EPSILON 1.19209290E-07F /* b**(1-p) */ +#define FLT_DIG 6 /* floor((p-1)*log10(b))+(b == 10) */ +#define FLT_MIN_EXP (-125) /* emin */ +#define FLT_MIN 1.17549435E-38F /* b**(emin-1) */ +#define FLT_MIN_10_EXP (-37) /* ceil(log10(b**(emin-1))) */ +#define FLT_MAX_EXP 128 /* emax */ +#define FLT_MAX 3.40282347E+38F /* (1-b**(-p))*b**emax */ +#define FLT_MAX_10_EXP 38 /* floor(log10((1-b**(-p))*b**emax)) */ + +#define DBL_MANT_DIG 53 +#define DBL_EPSILON 2.2204460492503131E-16 +#define DBL_DIG 15 +#define DBL_MIN_EXP (-1021) +#define DBL_MIN 2.2250738585072014E-308 +#define DBL_MIN_10_EXP (-307) +#define DBL_MAX_EXP 1024 +#define DBL_MAX 1.7976931348623157E+308 +#define DBL_MAX_10_EXP 308 + +#define LDBL_MANT_DIG 64 +#define LDBL_EPSILON 1.0842021724855044340E-19L +#define LDBL_DIG 18 +#define LDBL_MIN_EXP (-16381) +#define LDBL_MIN 3.3621031431120935063E-4932L +#define LDBL_MIN_10_EXP (-4931) +#define LDBL_MAX_EXP 16384 +#define LDBL_MAX 1.1897314953572317650E+4932L +#define LDBL_MAX_10_EXP 4932 +#endif /* _MACHINE_FLOAT_H_ */ diff --git a/src/include.new/floatingpoint.h b/src/include.new/floatingpoint.h new file mode 100644 index 0000000..a1d8744 --- /dev/null +++ b/src/include.new/floatingpoint.h @@ -0,0 +1,43 @@ +/*- + * Copyright (c) 1993 Andrew Moore, Talke Studio + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * from: @(#) floatingpoint.h 1.0 (Berkeley) 9/23/93 + * $FreeBSD: src/sys/i386/include/floatingpoint.h,v 1.14 2005/04/02 17:31:42 netchild Exp $ + */ + +#ifndef _FLOATINGPOINT_H_ +#define _FLOATINGPOINT_H_ + +#include +#include + +#endif /* !_FLOATINGPOINT_H_ */ diff --git a/src/include.new/fmtmsg.h b/src/include.new/fmtmsg.h new file mode 100644 index 0000000..256cf33 --- /dev/null +++ b/src/include.new/fmtmsg.h @@ -0,0 +1,73 @@ +/*- + * Copyright (c) 2002 Mike Barcroft + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD: src/include/fmtmsg.h,v 1.2 2002/08/05 16:37:05 mike Exp $ + */ + +#ifndef _FMTMSG_H_ +#define _FMTMSG_H_ + +/* Source of condition is... */ +#define MM_HARD 0x0001 /* ...hardware. */ +#define MM_SOFT 0x0002 /* ...software. */ +#define MM_FIRM 0x0004 /* ...fireware. */ + +/* Condition detected by... */ +#define MM_APPL 0x0010 /* ...application. */ +#define MM_UTIL 0x0020 /* ...utility. */ +#define MM_OPSYS 0x0040 /* ...operating system. */ + +/* Display on... */ +#define MM_PRINT 0x0100 /* ...standard error. */ +#define MM_CONSOLE 0x0200 /* ...system console. */ + +#define MM_RECOVER 0x1000 /* Recoverable error. */ +#define MM_NRECOV 0x2000 /* Non-recoverable error. */ + +/* Severity levels. */ +#define MM_NOSEV 0 /* No severity level provided. */ +#define MM_HALT 1 /* Error causing application to halt. */ +#define MM_ERROR 2 /* Non-fault fault. */ +#define MM_WARNING 3 /* Unusual non-error condition. */ +#define MM_INFO 4 /* Informative message. */ + +/* Null options. */ +#define MM_NULLLBL (char *)0 +#define MM_NULLSEV 0 +#define MM_NULLMC 0L +#define MM_NULLTXT (char *)0 +#define MM_NULLACT (char *)0 +#define MM_NULLTAG (char *)0 + +/* Return values. */ +#define MM_OK 0 /* Success. */ +#define MM_NOMSG 1 /* Failed to output to stderr. */ +#define MM_NOCON 2 /* Failed to output to console. */ +#define MM_NOTOK 3 /* Failed to output anything. */ + +int fmtmsg(long, const char *, int, const char *, const char *, + const char *); + +#endif /* !_FMTMSG_H_ */ diff --git a/src/include.new/fnmatch.h b/src/include.new/fnmatch.h new file mode 100644 index 0000000..d1cc03a --- /dev/null +++ b/src/include.new/fnmatch.h @@ -0,0 +1,63 @@ +/*- + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD: src/include/fnmatch.h,v 1.15 2003/12/18 10:41:39 jkh Exp $ + * @(#)fnmatch.h 8.1 (Berkeley) 6/2/93 + */ + +#ifndef _FNMATCH_H_ +#define _FNMATCH_H_ + +#include + +#define FNM_NOMATCH 1 /* Match failed. */ + +#define FNM_NOESCAPE 0x01 /* Disable backslash escaping. */ +#define FNM_PATHNAME 0x02 /* Slash must be matched by slash. */ +#define FNM_PERIOD 0x04 /* Period must be matched by period. */ + +#if __XSI_VISIBLE +#define FNM_NOSYS (-1) /* Reserved. */ +#endif + +#if __BSD_VISIBLE +#define FNM_LEADING_DIR 0x08 /* Ignore / after Imatch. */ +#define FNM_CASEFOLD 0x10 /* Case insensitive search. */ +#define FNM_IGNORECASE FNM_CASEFOLD +#define FNM_FILE_NAME FNM_PATHNAME +#endif + +__BEGIN_DECLS +int fnmatch(const char *, const char *, int); +__END_DECLS + +#endif /* !_FNMATCH_H_ */ diff --git a/src/include.new/form.h b/src/include.new/form.h new file mode 100644 index 0000000..140b25f --- /dev/null +++ b/src/include.new/form.h @@ -0,0 +1,383 @@ +/**************************************************************************** + * Copyright (c) 1998,2000 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Juergen Pfeifer 1995,1997 * + ****************************************************************************/ + +#ifndef FORM_H +#define FORM_H + +#include +#include + +#ifdef __cplusplus + extern "C" { +#endif + +typedef int Form_Options; +typedef int Field_Options; + + /********** + * _PAGE * + **********/ + +typedef struct { + short pmin; /* index of first field on page */ + short pmax; /* index of last field on page */ + short smin; /* index of top leftmost field on page */ + short smax; /* index of bottom rightmost field on page */ +} _PAGE; + + /********** + * FIELD * + **********/ + +typedef struct fieldnode { + unsigned short status; /* flags */ + short rows; /* size in rows */ + short cols; /* size in cols */ + short frow; /* first row */ + short fcol; /* first col */ + int drows; /* dynamic rows */ + int dcols; /* dynamic cols */ + int maxgrow; /* maximum field growth */ + int nrow; /* offscreen rows */ + short nbuf; /* additional buffers */ + short just; /* justification */ + short page; /* page on form */ + short index; /* into form -> field */ + int pad; /* pad character */ + chtype fore; /* foreground attribute */ + chtype back; /* background attribute */ + Field_Options opts; /* options */ + struct fieldnode * snext; /* sorted order pointer */ + struct fieldnode * sprev; /* sorted order pointer */ + struct fieldnode * link; /* linked field chain */ + struct formnode * form; /* containing form */ + struct typenode * type; /* field type */ + void * arg; /* argument for type */ + char * buf; /* field buffers */ + void * usrptr; /* user pointer */ +} FIELD; + + /************** + * FIELDTYPE * + **************/ + +typedef struct typenode { + unsigned short status; /* flags */ + long ref; /* reference count */ + struct typenode * left; /* ptr to operand for | */ + struct typenode * right; /* ptr to operand for | */ + + void* (*makearg)(va_list *); /* make fieldtype arg */ + void* (*copyarg)(const void *); /* copy fieldtype arg */ + void (*freearg)(void *); /* free fieldtype arg */ + + bool (*fcheck)(FIELD *,const void *); /* field validation */ + bool (*ccheck)(int,const void *); /* character validation */ + + bool (*next)(FIELD *,const void *); /* enumerate next value */ + bool (*prev)(FIELD *,const void *); /* enumerate prev value */ + +} FIELDTYPE; + + /********* + * FORM * + *********/ + +typedef struct formnode { + unsigned short status; /* flags */ + short rows; /* size in rows */ + short cols; /* size in cols */ + int currow; /* current row in field window*/ + int curcol; /* current col in field window*/ + int toprow; /* in scrollable field window */ + int begincol; /* in horiz. scrollable field */ + short maxfield; /* number of fields */ + short maxpage; /* number of pages */ + short curpage; /* index into page */ + Form_Options opts; /* options */ + WINDOW * win; /* window */ + WINDOW * sub; /* subwindow */ + WINDOW * w; /* window for current field */ + FIELD ** field; /* field [maxfield] */ + FIELD * current; /* current field */ + _PAGE * page; /* page [maxpage] */ + void * usrptr; /* user pointer */ + + void (*forminit)(struct formnode *); + void (*formterm)(struct formnode *); + void (*fieldinit)(struct formnode *); + void (*fieldterm)(struct formnode *); + +} FORM; + +typedef void (*Form_Hook)(FORM *); + + /*************************** + * miscellaneous #defines * + ***************************/ + +/* field justification */ +#define NO_JUSTIFICATION (0) +#define JUSTIFY_LEFT (1) +#define JUSTIFY_CENTER (2) +#define JUSTIFY_RIGHT (3) + +/* field options */ +#define O_VISIBLE (0x0001) +#define O_ACTIVE (0x0002) +#define O_PUBLIC (0x0004) +#define O_EDIT (0x0008) +#define O_WRAP (0x0010) +#define O_BLANK (0x0020) +#define O_AUTOSKIP (0x0040) +#define O_NULLOK (0x0080) +#define O_PASSOK (0x0100) +#define O_STATIC (0x0200) + +/* form options */ +#define O_NL_OVERLOAD (0x0001) +#define O_BS_OVERLOAD (0x0002) + +/* form driver commands */ +#define REQ_NEXT_PAGE (KEY_MAX + 1) /* move to next page */ +#define REQ_PREV_PAGE (KEY_MAX + 2) /* move to previous page */ +#define REQ_FIRST_PAGE (KEY_MAX + 3) /* move to first page */ +#define REQ_LAST_PAGE (KEY_MAX + 4) /* move to last page */ + +#define REQ_NEXT_FIELD (KEY_MAX + 5) /* move to next field */ +#define REQ_PREV_FIELD (KEY_MAX + 6) /* move to previous field */ +#define REQ_FIRST_FIELD (KEY_MAX + 7) /* move to first field */ +#define REQ_LAST_FIELD (KEY_MAX + 8) /* move to last field */ +#define REQ_SNEXT_FIELD (KEY_MAX + 9) /* move to sorted next field */ +#define REQ_SPREV_FIELD (KEY_MAX + 10) /* move to sorted prev field */ +#define REQ_SFIRST_FIELD (KEY_MAX + 11) /* move to sorted first field */ +#define REQ_SLAST_FIELD (KEY_MAX + 12) /* move to sorted last field */ +#define REQ_LEFT_FIELD (KEY_MAX + 13) /* move to left to field */ +#define REQ_RIGHT_FIELD (KEY_MAX + 14) /* move to right to field */ +#define REQ_UP_FIELD (KEY_MAX + 15) /* move to up to field */ +#define REQ_DOWN_FIELD (KEY_MAX + 16) /* move to down to field */ + +#define REQ_NEXT_CHAR (KEY_MAX + 17) /* move to next char in field */ +#define REQ_PREV_CHAR (KEY_MAX + 18) /* move to prev char in field */ +#define REQ_NEXT_LINE (KEY_MAX + 19) /* move to next line in field */ +#define REQ_PREV_LINE (KEY_MAX + 20) /* move to prev line in field */ +#define REQ_NEXT_WORD (KEY_MAX + 21) /* move to next word in field */ +#define REQ_PREV_WORD (KEY_MAX + 22) /* move to prev word in field */ +#define REQ_BEG_FIELD (KEY_MAX + 23) /* move to first char in field */ +#define REQ_END_FIELD (KEY_MAX + 24) /* move after last char in fld */ +#define REQ_BEG_LINE (KEY_MAX + 25) /* move to beginning of line */ +#define REQ_END_LINE (KEY_MAX + 26) /* move after last char in line */ +#define REQ_LEFT_CHAR (KEY_MAX + 27) /* move left in field */ +#define REQ_RIGHT_CHAR (KEY_MAX + 28) /* move right in field */ +#define REQ_UP_CHAR (KEY_MAX + 29) /* move up in field */ +#define REQ_DOWN_CHAR (KEY_MAX + 30) /* move down in field */ + +#define REQ_NEW_LINE (KEY_MAX + 31) /* insert/overlay new line */ +#define REQ_INS_CHAR (KEY_MAX + 32) /* insert blank char at cursor */ +#define REQ_INS_LINE (KEY_MAX + 33) /* insert blank line at cursor */ +#define REQ_DEL_CHAR (KEY_MAX + 34) /* delete char at cursor */ +#define REQ_DEL_PREV (KEY_MAX + 35) /* delete char before cursor */ +#define REQ_DEL_LINE (KEY_MAX + 36) /* delete line at cursor */ +#define REQ_DEL_WORD (KEY_MAX + 37) /* delete line at cursor */ +#define REQ_CLR_EOL (KEY_MAX + 38) /* clear to end of line */ +#define REQ_CLR_EOF (KEY_MAX + 39) /* clear to end of field */ +#define REQ_CLR_FIELD (KEY_MAX + 40) /* clear entire field */ +#define REQ_OVL_MODE (KEY_MAX + 41) /* begin overlay mode */ +#define REQ_INS_MODE (KEY_MAX + 42) /* begin insert mode */ +#define REQ_SCR_FLINE (KEY_MAX + 43) /* scroll field forward a line */ +#define REQ_SCR_BLINE (KEY_MAX + 44) /* scroll field backward a line */ +#define REQ_SCR_FPAGE (KEY_MAX + 45) /* scroll field forward a page */ +#define REQ_SCR_BPAGE (KEY_MAX + 46) /* scroll field backward a page */ +#define REQ_SCR_FHPAGE (KEY_MAX + 47) /* scroll field forward half page */ +#define REQ_SCR_BHPAGE (KEY_MAX + 48) /* scroll field backward half page */ +#define REQ_SCR_FCHAR (KEY_MAX + 49) /* horizontal scroll char */ +#define REQ_SCR_BCHAR (KEY_MAX + 50) /* horizontal scroll char */ +#define REQ_SCR_HFLINE (KEY_MAX + 51) /* horizontal scroll line */ +#define REQ_SCR_HBLINE (KEY_MAX + 52) /* horizontal scroll line */ +#define REQ_SCR_HFHALF (KEY_MAX + 53) /* horizontal scroll half line */ +#define REQ_SCR_HBHALF (KEY_MAX + 54) /* horizontal scroll half line */ + +#define REQ_VALIDATION (KEY_MAX + 55) /* validate field */ +#define REQ_NEXT_CHOICE (KEY_MAX + 56) /* display next field choice */ +#define REQ_PREV_CHOICE (KEY_MAX + 57) /* display prev field choice */ + +#define MIN_FORM_COMMAND (KEY_MAX + 1) /* used by form_driver */ +#define MAX_FORM_COMMAND (KEY_MAX + 57) /* used by form_driver */ + +#if defined(MAX_COMMAND) +# if (MAX_FORM_COMMAND > MAX_COMMAND) +# error Something is wrong -- MAX_FORM_COMMAND is greater than MAX_COMMAND +# elif (MAX_COMMAND != (KEY_MAX + 128)) +# error Something is wrong -- MAX_COMMAND is already inconsistently defined. +# endif +#else +# define MAX_COMMAND (KEY_MAX + 128) +#endif + + /************************* + * standard field types * + *************************/ +extern NCURSES_EXPORT_VAR(FIELDTYPE *) TYPE_ALPHA; +extern NCURSES_EXPORT_VAR(FIELDTYPE *) TYPE_ALNUM; +extern NCURSES_EXPORT_VAR(FIELDTYPE *) TYPE_ENUM; +extern NCURSES_EXPORT_VAR(FIELDTYPE *) TYPE_INTEGER; +extern NCURSES_EXPORT_VAR(FIELDTYPE *) TYPE_NUMERIC; +extern NCURSES_EXPORT_VAR(FIELDTYPE *) TYPE_REGEXP; + + /************************************ + * built-in additional field types * + * They are not defined in SVr4 * + ************************************/ +extern NCURSES_EXPORT_VAR(FIELDTYPE *) TYPE_IPV4; /* Internet IP Version 4 address */ + + /*********************** + * Default objects * + ***********************/ +extern NCURSES_EXPORT_VAR(FORM *) _nc_Default_Form; +extern NCURSES_EXPORT_VAR(FIELD *) _nc_Default_Field; + + + /*********************** + * FIELDTYPE routines * + ***********************/ +extern NCURSES_EXPORT(FIELDTYPE *) new_fieldtype ( + bool (* const field_check)(FIELD *,const void *), + bool (* const char_check)(int,const void *)), + *link_fieldtype(FIELDTYPE *,FIELDTYPE *); + +extern NCURSES_EXPORT(int) free_fieldtype (FIELDTYPE *); +extern NCURSES_EXPORT(int) set_fieldtype_arg (FIELDTYPE *, + void * (* const make_arg)(va_list *), + void * (* const copy_arg)(const void *), + void (* const free_arg)(void *)); +extern NCURSES_EXPORT(int) set_fieldtype_choice (FIELDTYPE *, + bool (* const next_choice)(FIELD *,const void *), + bool (* const prev_choice)(FIELD *,const void *)); + + /******************* + * FIELD routines * + *******************/ +extern NCURSES_EXPORT(FIELD *) new_field (int,int,int,int,int,int); +extern NCURSES_EXPORT(FIELD *) dup_field (FIELD *,int,int); +extern NCURSES_EXPORT(FIELD *) link_field (FIELD *,int,int); + +extern NCURSES_EXPORT(int) free_field (FIELD *); +extern NCURSES_EXPORT(int) field_info (const FIELD *,int *,int *,int *,int *,int *,int *); +extern NCURSES_EXPORT(int) dynamic_field_info (const FIELD *,int *,int *,int *); +extern NCURSES_EXPORT(int) set_max_field ( FIELD *,int); +extern NCURSES_EXPORT(int) move_field (FIELD *,int,int); +extern NCURSES_EXPORT(int) set_field_type (FIELD *,FIELDTYPE *,...); +extern NCURSES_EXPORT(int) set_new_page (FIELD *,bool); +extern NCURSES_EXPORT(int) set_field_just (FIELD *,int); +extern NCURSES_EXPORT(int) field_just (const FIELD *); +extern NCURSES_EXPORT(int) set_field_fore (FIELD *,chtype); +extern NCURSES_EXPORT(int) set_field_back (FIELD *,chtype); +extern NCURSES_EXPORT(int) set_field_pad (FIELD *,int); +extern NCURSES_EXPORT(int) field_pad (const FIELD *); +extern NCURSES_EXPORT(int) set_field_buffer (FIELD *,int,const char *); +extern NCURSES_EXPORT(int) set_field_status (FIELD *,bool); +extern NCURSES_EXPORT(int) set_field_userptr (FIELD *, void *); +extern NCURSES_EXPORT(int) set_field_opts (FIELD *,Field_Options); +extern NCURSES_EXPORT(int) field_opts_on (FIELD *,Field_Options); +extern NCURSES_EXPORT(int) field_opts_off (FIELD *,Field_Options); + +extern NCURSES_EXPORT(chtype) field_fore (const FIELD *); +extern NCURSES_EXPORT(chtype) field_back (const FIELD *); + +extern NCURSES_EXPORT(bool) new_page (const FIELD *); +extern NCURSES_EXPORT(bool) field_status (const FIELD *); + +extern NCURSES_EXPORT(void *) field_arg (const FIELD *); + +extern NCURSES_EXPORT(void *) field_userptr (const FIELD *); + +extern NCURSES_EXPORT(FIELDTYPE *) field_type (const FIELD *); + +extern NCURSES_EXPORT(char *) field_buffer (const FIELD *,int); + +extern NCURSES_EXPORT(Field_Options) field_opts (const FIELD *); + + /****************** + * FORM routines * + ******************/ + +extern NCURSES_EXPORT(FORM *) new_form (FIELD **); + +extern NCURSES_EXPORT(FIELD **) form_fields (const FORM *); +extern NCURSES_EXPORT(FIELD *) current_field (const FORM *); + +extern NCURSES_EXPORT(WINDOW *) form_win (const FORM *); +extern NCURSES_EXPORT(WINDOW *) form_sub (const FORM *); + +extern NCURSES_EXPORT(Form_Hook) form_init (const FORM *); +extern NCURSES_EXPORT(Form_Hook) form_term (const FORM *); +extern NCURSES_EXPORT(Form_Hook) field_init (const FORM *); +extern NCURSES_EXPORT(Form_Hook) field_term (const FORM *); + +extern NCURSES_EXPORT(int) free_form (FORM *); +extern NCURSES_EXPORT(int) set_form_fields (FORM *,FIELD **); +extern NCURSES_EXPORT(int) field_count (const FORM *); +extern NCURSES_EXPORT(int) set_form_win (FORM *,WINDOW *); +extern NCURSES_EXPORT(int) set_form_sub (FORM *,WINDOW *); +extern NCURSES_EXPORT(int) set_current_field (FORM *,FIELD *); +extern NCURSES_EXPORT(int) field_index (const FIELD *); +extern NCURSES_EXPORT(int) set_form_page (FORM *,int); +extern NCURSES_EXPORT(int) form_page (const FORM *); +extern NCURSES_EXPORT(int) scale_form (const FORM *,int *,int *); +extern NCURSES_EXPORT(int) set_form_init (FORM *,Form_Hook); +extern NCURSES_EXPORT(int) set_form_term (FORM *,Form_Hook); +extern NCURSES_EXPORT(int) set_field_init (FORM *,Form_Hook); +extern NCURSES_EXPORT(int) set_field_term (FORM *,Form_Hook); +extern NCURSES_EXPORT(int) post_form (FORM *); +extern NCURSES_EXPORT(int) unpost_form (FORM *); +extern NCURSES_EXPORT(int) pos_form_cursor (FORM *); +extern NCURSES_EXPORT(int) form_driver (FORM *,int); +extern NCURSES_EXPORT(int) set_form_userptr (FORM *,void *); +extern NCURSES_EXPORT(int) set_form_opts (FORM *,Form_Options); +extern NCURSES_EXPORT(int) form_opts_on (FORM *,Form_Options); +extern NCURSES_EXPORT(int) form_opts_off (FORM *,Form_Options); +extern NCURSES_EXPORT(int) form_request_by_name (const char *); + +extern NCURSES_EXPORT(const char *) form_request_name (int); + +extern NCURSES_EXPORT(void *) form_userptr (const FORM *); + +extern NCURSES_EXPORT(Form_Options) form_opts (const FORM *); + +extern NCURSES_EXPORT(bool) data_ahead (const FORM *); +extern NCURSES_EXPORT(bool) data_behind (const FORM *); + +#ifdef __cplusplus + } +#endif + +#endif /* FORM_H */ diff --git a/src/include.new/fstab.h b/src/include.new/fstab.h new file mode 100644 index 0000000..22d807c --- /dev/null +++ b/src/include.new/fstab.h @@ -0,0 +1,82 @@ +/* + * Copyright (c) 1980, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)fstab.h 8.1 (Berkeley) 6/2/93 + * $FreeBSD: src/include/fstab.h,v 1.4 2003/04/07 12:54:59 mdodd Exp $ + */ + +#ifndef _FSTAB_H_ +#define _FSTAB_H_ + +/* + * File system table, see fstab(5). + * + * Used by dump, mount, umount, swapon, fsck, df, ... + * + * For ufs fs_spec field is the block special name. Programs that want to + * use the character special name must create that name by prepending a 'r' + * after the right most slash. Quota files are always named "quotas", so + * if type is "rq", then use concatenation of fs_file and "quotas" to locate + * quota file. + */ +#define _PATH_FSTAB "/etc/fstab" +#define FSTAB "/etc/fstab" /* deprecated */ + +#define FSTAB_RW "rw" /* read/write device */ +#define FSTAB_RQ "rq" /* read/write with quotas */ +#define FSTAB_RO "ro" /* read-only device */ +#define FSTAB_SW "sw" /* swap device */ +#define FSTAB_XX "xx" /* ignore totally */ + +struct fstab { + char *fs_spec; /* block special device name */ + char *fs_file; /* file system path prefix */ + char *fs_vfstype; /* File system type, ufs, nfs */ + char *fs_mntops; /* Mount options ala -o */ + char *fs_type; /* FSTAB_* from fs_mntops */ + int fs_freq; /* dump frequency, in days */ + int fs_passno; /* pass number on parallel fsck */ +}; + +#include + +__BEGIN_DECLS +struct fstab *getfsent(void); +struct fstab *getfsspec(const char *); +struct fstab *getfsfile(const char *); +int setfsent(void); +void endfsent(void); +void setfstab(const char *); +const char *getfstab(void); +__END_DECLS + +#endif /* !_FSTAB_H_ */ diff --git a/src/include.new/ftpio.h b/src/include.new/ftpio.h new file mode 100644 index 0000000..5799d6a --- /dev/null +++ b/src/include.new/ftpio.h @@ -0,0 +1,71 @@ +#ifndef _FTP_H_INCLUDE +#define _FTP_H_INCLUDE + +#include +#include +#include +#include + +/* + * ---------------------------------------------------------------------------- + * "THE BEER-WARE LICENSE" (Revision 42): + * wrote this file. As long as you retain this notice you + * can do whatever you want with this stuff. If we meet some day, and you think + * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp + * ---------------------------------------------------------------------------- + * + * Major Changelog: + * + * Jordan K. Hubbard + * 17 Jan 1996 + * + * Turned inside out. Now returns xfers as new file ids, not as a special + * `state' of FTP_t + * + * $FreeBSD: src/lib/libftpio/ftpio.h,v 1.17 2002/03/25 13:49:48 phk Exp $ + */ + +/* Internal housekeeping data structure for FTP sessions */ +typedef struct { + enum { init, isopen, quit } con_state; + int fd_ctrl; + int addrtype; + char *host; + char *file; + int error; + int is_binary; + int is_passive; + int is_verbose; +} *FTP_t; + +/* Structure we use to match FTP error codes with readable strings */ +struct ftperr { + const int num; + const char *string; +}; + +__BEGIN_DECLS +extern struct ftperr ftpErrList[]; +extern int const ftpErrListLength; + +/* Exported routines - deal only with FILE* type */ +extern FILE *ftpLogin(char *host, char *user, char *passwd, int port, int verbose, int *retcode); +extern int ftpChdir(FILE *fp, char *dir); +extern int ftpErrno(FILE *fp); +extern off_t ftpGetSize(FILE *fp, char *file); +extern FILE *ftpGet(FILE *fp, char *file, off_t *seekto); +extern FILE *ftpPut(FILE *fp, char *file); +extern int ftpAscii(FILE *fp); +extern int ftpBinary(FILE *fp); +extern int ftpPassive(FILE *fp, int status); +extern void ftpVerbose(FILE *fp, int status); +extern FILE *ftpGetURL(char *url, char *user, char *passwd, int *retcode); +extern FILE *ftpPutURL(char *url, char *user, char *passwd, int *retcode); +extern time_t ftpGetModtime(FILE *fp, char *s); +extern const char *ftpErrString(int error); +extern FILE *ftpLoginAf(char *host, int af, char *user, char *passwd, int port, int verbose, int *retcode); +extern FILE *ftpGetURLAf(char *url, int af, char *user, char *passwd, int *retcode); +extern FILE *ftpPutURLAf(char *url, int af, char *user, char *passwd, int *retcode); +__END_DECLS + +#endif /* _FTP_H_INCLUDE */ diff --git a/src/include.new/fts.h b/src/include.new/fts.h new file mode 100644 index 0000000..2178559 --- /dev/null +++ b/src/include.new/fts.h @@ -0,0 +1,145 @@ +/* + * Copyright (c) 1989, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)fts.h 8.3 (Berkeley) 8/14/94 + * $FreeBSD: src/include/fts.h,v 1.11 2005/01/07 00:06:20 pjd Exp $ + */ + +#ifndef _FTS_H_ +#define _FTS_H_ + +typedef struct { + struct _ftsent *fts_cur; /* current node */ + struct _ftsent *fts_child; /* linked list of children */ + struct _ftsent **fts_array; /* sort array */ + dev_t fts_dev; /* starting device # */ + char *fts_path; /* path for this descent */ + int fts_rfd; /* fd for root */ + int fts_pathlen; /* sizeof(path) */ + int fts_nitems; /* elements in the sort array */ + int (*fts_compar) /* compare function */ + (const struct _ftsent * const *, const struct _ftsent * const *); + +#define FTS_COMFOLLOW 0x001 /* follow command line symlinks */ +#define FTS_LOGICAL 0x002 /* logical walk */ +#define FTS_NOCHDIR 0x004 /* don't change directories */ +#define FTS_NOSTAT 0x008 /* don't get stat info */ +#define FTS_PHYSICAL 0x010 /* physical walk */ +#define FTS_SEEDOT 0x020 /* return dot and dot-dot */ +#define FTS_XDEV 0x040 /* don't cross devices */ +#define FTS_WHITEOUT 0x080 /* return whiteout information */ +#define FTS_OPTIONMASK 0x0ff /* valid user option mask */ + +#define FTS_NAMEONLY 0x100 /* (private) child names only */ +#define FTS_STOP 0x200 /* (private) unrecoverable error */ + int fts_options; /* fts_open options, global flags */ + void *fts_clientptr; /* thunk for sort function */ +} FTS; + +typedef struct _ftsent { + struct _ftsent *fts_cycle; /* cycle node */ + struct _ftsent *fts_parent; /* parent directory */ + struct _ftsent *fts_link; /* next file in directory */ + union { + struct { + long __fts_number; /* local numeric value */ + void *__fts_pointer; /* local address value */ + } __struct_ftsent; + int64_t __fts_bignum; + } __union_ftsent; +#define fts_number __union_ftsent.__struct_ftsent.__fts_number +#define fts_pointer __union_ftsent.__struct_ftsent.__fts_pointer +#define fts_bignum __union_ftsent.__fts_bignum + char *fts_accpath; /* access path */ + char *fts_path; /* root path */ + int fts_errno; /* errno for this node */ + int fts_symfd; /* fd for symlink */ + u_short fts_pathlen; /* strlen(fts_path) */ + u_short fts_namelen; /* strlen(fts_name) */ + + ino_t fts_ino; /* inode */ + dev_t fts_dev; /* device */ + nlink_t fts_nlink; /* link count */ + +#define FTS_ROOTPARENTLEVEL -1 +#define FTS_ROOTLEVEL 0 + short fts_level; /* depth (-1 to N) */ + +#define FTS_D 1 /* preorder directory */ +#define FTS_DC 2 /* directory that causes cycles */ +#define FTS_DEFAULT 3 /* none of the above */ +#define FTS_DNR 4 /* unreadable directory */ +#define FTS_DOT 5 /* dot or dot-dot */ +#define FTS_DP 6 /* postorder directory */ +#define FTS_ERR 7 /* error; errno is set */ +#define FTS_F 8 /* regular file */ +#define FTS_INIT 9 /* initialized only */ +#define FTS_NS 10 /* stat(2) failed */ +#define FTS_NSOK 11 /* no stat(2) requested */ +#define FTS_SL 12 /* symbolic link */ +#define FTS_SLNONE 13 /* symbolic link without target */ +#define FTS_W 14 /* whiteout object */ + u_short fts_info; /* user flags for FTSENT structure */ + +#define FTS_DONTCHDIR 0x01 /* don't chdir .. to the parent */ +#define FTS_SYMFOLLOW 0x02 /* followed a symlink to get here */ +#define FTS_ISW 0x04 /* this is a whiteout object */ + u_short fts_flags; /* private flags for FTSENT structure */ + +#define FTS_AGAIN 1 /* read node again */ +#define FTS_FOLLOW 2 /* follow symbolic link */ +#define FTS_NOINSTR 3 /* no instructions */ +#define FTS_SKIP 4 /* discard node */ + u_short fts_instr; /* fts_set() instructions */ + + struct stat *fts_statp; /* stat(2) information */ + char *fts_name; /* file name */ + FTS *fts_fts; /* back pointer to main FTS */ +} FTSENT; + +#include + +__BEGIN_DECLS +FTSENT *fts_children(FTS *, int); +int fts_close(FTS *); +void *fts_get_clientptr(FTS *); +#define fts_get_clientptr(fts) ((fts)->fts_clientptr) +FTS *fts_get_stream(FTSENT *); +#define fts_get_stream(ftsent) ((ftsent)->fts_fts) +FTS *fts_open(char * const *, int, + int (*)(const FTSENT * const *, const FTSENT * const *)); +FTSENT *fts_read(FTS *); +int fts_set(FTS *, FTSENT *, int); +void fts_set_clientptr(FTS *, void *); +__END_DECLS + +#endif /* !_FTS_H_ */ diff --git a/src/include.new/ftw.h b/src/include.new/ftw.h new file mode 100644 index 0000000..9fc3ede --- /dev/null +++ b/src/include.new/ftw.h @@ -0,0 +1,62 @@ +/* $OpenBSD: ftw.h,v 1.1 2003/07/21 21:13:18 millert Exp $ */ + +/* + * Copyright (c) 2003 Todd C. Miller + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * Sponsored in part by the Defense Advanced Research Projects + * Agency (DARPA) and Air Force Research Laboratory, Air Force + * Materiel Command, USAF, under agreement number F39502-99-1-0512. + * + * $FreeBSD: src/include/ftw.h,v 1.2 2004/08/24 13:00:54 tjr Exp $ + */ + +#ifndef _FTW_H +#define _FTW_H + +#include +#include + +/* + * Valid flags for the 3rd argument to the function that is passed as the + * second argument to ftw(3) and nftw(3). Say it three times fast! + */ +#define FTW_F 0 /* File. */ +#define FTW_D 1 /* Directory. */ +#define FTW_DNR 2 /* Directory without read permission. */ +#define FTW_DP 3 /* Directory with subdirectories visited. */ +#define FTW_NS 4 /* Unknown type; stat() failed. */ +#define FTW_SL 5 /* Symbolic link. */ +#define FTW_SLN 6 /* Sym link that names a nonexistent file. */ + +/* + * Flags for use as the 4th argument to nftw(3). These may be ORed together. + */ +#define FTW_PHYS 0x01 /* Physical walk, don't follow sym links. */ +#define FTW_MOUNT 0x02 /* The walk does not cross a mount point. */ +#define FTW_DEPTH 0x04 /* Subdirs visited before the dir itself. */ +#define FTW_CHDIR 0x08 /* Change to a directory before reading it. */ + +struct FTW { + int base; + int level; +}; + +__BEGIN_DECLS +int ftw(const char *, int (*)(const char *, const struct stat *, int), int); +int nftw(const char *, int (*)(const char *, const struct stat *, int, + struct FTW *), int, int); +__END_DECLS + +#endif /* !_FTW_H */ diff --git a/src/include.new/g2c.h b/src/include.new/g2c.h new file mode 100644 index 0000000..71e021d --- /dev/null +++ b/src/include.new/g2c.h @@ -0,0 +1,236 @@ +/* g2c.h -- g77 version of f2c (Standard Fortran to C header file) */ + +/* This file is generated by the g77 libg2c configuration process from a + file named g2c.hin. This process sets up the appropriate types, + defines the appropriate macros, and so on. The resulting g2c.h file + is used to build g77's copy of libf2c, named libg2c, and also can + be used when compiling C code produced by f2c to link the resulting + object file(s) with those produced by the same version of g77 that + produced this file, allowing inter-operability of f2c-compiled and + g77-compiled code. */ + +/** barf [ba:rf] 2. "He suggested using FORTRAN, and everybody barfed." + + - From The Shogakukan DICTIONARY OF NEW ENGLISH (Second edition) */ + +#ifndef F2C_INCLUDE +#define F2C_INCLUDE + +/* F2C_INTEGER will normally be `int' but would be `long' on 16-bit systems */ +/* we assume short, float are OK */ +typedef int /* long int */ integer; +typedef unsigned long int /* long */ uinteger; +typedef char *address; +typedef short int shortint; +typedef float real; +typedef double doublereal; +typedef struct { real r, i; } complex; +typedef struct { doublereal r, i; } doublecomplex; +typedef int /* long int */ logical; +typedef short int shortlogical; +typedef char logical1; +typedef char integer1; +typedef long long int /* long long */ longint; /* system-dependent */ +typedef unsigned long long int /* long long */ ulongint; /* system-dependent */ +#define qbit_clear(a,b) ((a) & ~((ulongint)1 << (b))) +#define qbit_set(a,b) ((a) | ((ulongint)1 << (b))) + +#define TRUE_ (1) +#define FALSE_ (0) + +/* Extern is for use with -E */ +#ifndef Extern +#define Extern extern +#endif + +/* I/O stuff */ + +#ifdef f2c_i2 +#error "f2c_i2 will not work with g77!!!!" +/* for -i2 */ +typedef short flag; +typedef short ftnlen; +typedef short ftnint; +#else +typedef int /* long int */ flag; +typedef int /* long int */ ftnlen; +typedef int /* long int */ ftnint; +#endif + +/*external read, write*/ +typedef struct +{ flag cierr; + ftnint ciunit; + flag ciend; + char *cifmt; + ftnint cirec; +} cilist; + +/*internal read, write*/ +typedef struct +{ flag icierr; + char *iciunit; + flag iciend; + char *icifmt; + ftnint icirlen; + ftnint icirnum; +} icilist; + +/*open*/ +typedef struct +{ flag oerr; + ftnint ounit; + char *ofnm; + ftnlen ofnmlen; + char *osta; + char *oacc; + char *ofm; + ftnint orl; + char *oblnk; +} olist; + +/*close*/ +typedef struct +{ flag cerr; + ftnint cunit; + char *csta; +} cllist; + +/*rewind, backspace, endfile*/ +typedef struct +{ flag aerr; + ftnint aunit; +} alist; + +/* inquire */ +typedef struct +{ flag inerr; + ftnint inunit; + char *infile; + ftnlen infilen; + ftnint *inex; /*parameters in standard's order*/ + ftnint *inopen; + ftnint *innum; + ftnint *innamed; + char *inname; + ftnlen innamlen; + char *inacc; + ftnlen inacclen; + char *inseq; + ftnlen inseqlen; + char *indir; + ftnlen indirlen; + char *infmt; + ftnlen infmtlen; + char *inform; + ftnint informlen; + char *inunf; + ftnlen inunflen; + ftnint *inrecl; + ftnint *innrec; + char *inblank; + ftnlen inblanklen; +} inlist; + +#define VOID void + +union Multitype { /* for multiple entry points */ + integer1 g; + shortint h; + integer i; + /* longint j; */ + real r; + doublereal d; + complex c; + doublecomplex z; + }; + +typedef union Multitype Multitype; + +/*typedef long int Long;*/ /* No longer used; formerly in Namelist */ + +struct Vardesc { /* for Namelist */ + char *name; + char *addr; + ftnlen *dims; + int type; + }; +typedef struct Vardesc Vardesc; + +struct Namelist { + char *name; + Vardesc **vars; + int nvars; + }; +typedef struct Namelist Namelist; + +#define abs(x) ((x) >= 0 ? (x) : -(x)) +#define dabs(x) (doublereal)abs(x) +#define min(a,b) ((a) <= (b) ? (a) : (b)) +#define max(a,b) ((a) >= (b) ? (a) : (b)) +#define dmin(a,b) (doublereal)min(a,b) +#define dmax(a,b) (doublereal)max(a,b) +#define bit_test(a,b) ((a) >> (b) & 1) +#define bit_clear(a,b) ((a) & ~((uinteger)1 << (b))) +#define bit_set(a,b) ((a) | ((uinteger)1 << (b))) + +/* procedure parameter types for -A and -C++ */ + +#define F2C_proc_par_types 1 +#ifdef __cplusplus +typedef int /* Unknown procedure type */ (*U_fp)(...); +typedef shortint (*J_fp)(...); +typedef integer (*I_fp)(...); +typedef real (*R_fp)(...); +typedef doublereal (*D_fp)(...), (*E_fp)(...); +typedef /* Complex */ VOID (*C_fp)(...); +typedef /* Double Complex */ VOID (*Z_fp)(...); +typedef logical (*L_fp)(...); +typedef shortlogical (*K_fp)(...); +typedef /* Character */ VOID (*H_fp)(...); +typedef /* Subroutine */ int (*S_fp)(...); +#else +typedef int /* Unknown procedure type */ (*U_fp)(); +typedef shortint (*J_fp)(); +typedef integer (*I_fp)(); +typedef real (*R_fp)(); +typedef doublereal (*D_fp)(), (*E_fp)(); +typedef /* Complex */ VOID (*C_fp)(); +typedef /* Double Complex */ VOID (*Z_fp)(); +typedef logical (*L_fp)(); +typedef shortlogical (*K_fp)(); +typedef /* Character */ VOID (*H_fp)(); +typedef /* Subroutine */ int (*S_fp)(); +#endif +/* E_fp is for real functions when -R is not specified */ +typedef VOID C_f; /* complex function */ +typedef VOID H_f; /* character function */ +typedef VOID Z_f; /* double complex function */ +typedef doublereal E_f; /* real function with -R not specified */ + +/* undef any lower-case symbols that your C compiler predefines, e.g.: */ + +#ifndef Skip_f2c_Undefs +/* (No such symbols should be defined in a strict ANSI C compiler. + We can avoid trouble with f2c-translated code by using + gcc -ansi [-traditional].) */ +#undef cray +#undef gcos +#undef mc68010 +#undef mc68020 +#undef mips +#undef pdp11 +#undef sgi +#undef sparc +#undef sun +#undef sun2 +#undef sun3 +#undef sun4 +#undef u370 +#undef u3b +#undef u3b2 +#undef u3b5 +#undef unix +#undef vax +#endif +#endif diff --git a/src/include.new/getopt.h b/src/include.new/getopt.h new file mode 100644 index 0000000..ddacd89 --- /dev/null +++ b/src/include.new/getopt.h @@ -0,0 +1,85 @@ +/* $NetBSD: getopt.h,v 1.4 2000/07/07 10:43:54 ad Exp $ */ +/* $FreeBSD: src/include/getopt.h,v 1.6 2004/02/24 08:09:20 ache Exp $ */ + +/*- + * Copyright (c) 2000 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Dieter Baron and Thomas Klausner. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the NetBSD + * Foundation, Inc. and its contributors. + * 4. Neither the name of The NetBSD Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _GETOPT_H_ +#define _GETOPT_H_ + +#include + +/* + * GNU-like getopt_long()/getopt_long_only() with 4.4BSD optreset extension. + * getopt() is declared here too for GNU programs. + */ +#define no_argument 0 +#define required_argument 1 +#define optional_argument 2 + +struct option { + /* name of long option */ + const char *name; + /* + * one of no_argument, required_argument, and optional_argument: + * whether option takes an argument + */ + int has_arg; + /* if not NULL, set *flag to val when option found */ + int *flag; + /* if flag not NULL, value to set *flag to; else return value */ + int val; +}; + +__BEGIN_DECLS +int getopt_long(int, char * const *, const char *, + const struct option *, int *); +int getopt_long_only(int, char * const *, const char *, + const struct option *, int *); +#ifndef _GETOPT_DECLARED +#define _GETOPT_DECLARED +int getopt(int, char * const [], const char *); + +extern char *optarg; /* getopt(3) external variables */ +extern int optind, opterr, optopt; +#endif +#ifndef _OPTRESET_DECLARED +#define _OPTRESET_DECLARED +extern int optreset; /* getopt(3) external variable */ +#endif +__END_DECLS + +#endif /* !_GETOPT_H_ */ diff --git a/src/include.new/glob.h b/src/include.new/glob.h new file mode 100644 index 0000000..8a8d2aa --- /dev/null +++ b/src/include.new/glob.h @@ -0,0 +1,103 @@ +/* + * Copyright (c) 1989, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Guido van Rossum. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)glob.h 8.1 (Berkeley) 6/2/93 + * $FreeBSD: src/include/glob.h,v 1.7 2002/07/17 04:58:09 mikeh Exp $ + */ + +#ifndef _GLOB_H_ +#define _GLOB_H_ + +#include + +struct stat; +typedef struct { + int gl_pathc; /* Count of total paths so far. */ + int gl_matchc; /* Count of paths matching pattern. */ + int gl_offs; /* Reserved at beginning of gl_pathv. */ + int gl_flags; /* Copy of flags parameter to glob. */ + char **gl_pathv; /* List of paths matching pattern. */ + /* Copy of errfunc parameter to glob. */ + int (*gl_errfunc)(const char *, int); + + /* + * Alternate filesystem access methods for glob; replacement + * versions of closedir(3), readdir(3), opendir(3), stat(2) + * and lstat(2). + */ + void (*gl_closedir)(void *); + struct dirent *(*gl_readdir)(void *); + void *(*gl_opendir)(const char *); + int (*gl_lstat)(const char *, struct stat *); + int (*gl_stat)(const char *, struct stat *); +} glob_t; + +#if __POSIX_VISIBLE >= 199209 +/* Believed to have been introduced in 1003.2-1992 */ +#define GLOB_APPEND 0x0001 /* Append to output from previous call. */ +#define GLOB_DOOFFS 0x0002 /* Use gl_offs. */ +#define GLOB_ERR 0x0004 /* Return on error. */ +#define GLOB_MARK 0x0008 /* Append / to matching directories. */ +#define GLOB_NOCHECK 0x0010 /* Return pattern itself if nothing matches. */ +#define GLOB_NOSORT 0x0020 /* Don't sort. */ +#define GLOB_NOESCAPE 0x2000 /* Disable backslash escaping. */ + +/* Error values returned by glob(3) */ +#define GLOB_NOSPACE (-1) /* Malloc call failed. */ +#define GLOB_ABORTED (-2) /* Unignored error. */ +#define GLOB_NOMATCH (-3) /* No match and GLOB_NOCHECK was not set. */ +#define GLOB_NOSYS (-4) /* Obsolete: source comptability only. */ +#endif /* __POSIX_VISIBLE >= 199209 */ + +#if __BSD_VISIBLE +#define GLOB_ALTDIRFUNC 0x0040 /* Use alternately specified directory funcs. */ +#define GLOB_BRACE 0x0080 /* Expand braces ala csh. */ +#define GLOB_MAGCHAR 0x0100 /* Pattern had globbing characters. */ +#define GLOB_NOMAGIC 0x0200 /* GLOB_NOCHECK without magic chars (csh). */ +#define GLOB_QUOTE 0x0400 /* Quote special chars with \. */ +#define GLOB_TILDE 0x0800 /* Expand tilde names from the passwd file. */ +#define GLOB_LIMIT 0x1000 /* limit number of returned paths */ + +/* source compatibility, these are the old names */ +#define GLOB_MAXPATH GLOB_LIMIT +#define GLOB_ABEND GLOB_ABORTED +#endif /* __BSD_VISIBLE */ + +__BEGIN_DECLS +int glob(const char *, int, int (*)(const char *, int), glob_t *); +void globfree(glob_t *); +__END_DECLS + +#endif /* !_GLOB_H_ */ diff --git a/src/include.new/gnuregex.h b/src/include.new/gnuregex.h new file mode 100644 index 0000000..6767df4 --- /dev/null +++ b/src/include.new/gnuregex.h @@ -0,0 +1,33 @@ +/*- + * Copyright (c) 2004 David E. O'Brien + * Copyright (c) 2004 Andrey A. Chernov + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD: src/gnu/lib/libregex/gnuregex.h,v 1.3 2004/02/25 10:56:54 ache Exp $ + */ + +#ifdef __GNUC__ +#warning "Use -I/usr/include/gnu and instead of " +#endif +#include diff --git a/src/include.new/grp.h b/src/include.new/grp.h new file mode 100644 index 0000000..55a57a7 --- /dev/null +++ b/src/include.new/grp.h @@ -0,0 +1,91 @@ +/*- + * Copyright (c) 1989, 1993 + * The Regents of the University of California. All rights reserved. + * (c) UNIX System Laboratories, Inc. + * All or some portions of this file are derived from material licensed + * to the University of California by American Telephone and Telegraph + * Co. or Unix System Laboratories, Inc. and are reproduced herein with + * the permission of UNIX System Laboratories, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)grp.h 8.2 (Berkeley) 1/21/94 + * $FreeBSD: src/include/grp.h,v 1.18 2003/04/17 14:15:25 nectar Exp $ + */ + +#ifndef _GRP_H_ +#define _GRP_H_ + +#include +#include + +#define _PATH_GROUP "/etc/group" + +#ifndef _GID_T_DECLARED +typedef __gid_t gid_t; +#define _GID_T_DECLARED +#endif + +#ifndef _SIZE_T_DECLARED +typedef __size_t size_t; +#define _SIZE_T_DECLARED +#endif + +struct group { + char *gr_name; /* group name */ + char *gr_passwd; /* group password */ + gid_t gr_gid; /* group id */ + char **gr_mem; /* group members */ +}; + +__BEGIN_DECLS +#if __BSD_VISIBLE || __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE +void endgrent(void); +struct group *getgrent(void); +#endif +struct group *getgrgid(gid_t); +struct group *getgrnam(const char *); +#if __BSD_VISIBLE +const char *group_from_gid(gid_t, int); +#endif +#if __BSD_VISIBLE || __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE +/* XXX IEEE Std 1003.1, 2003 specifies `void setgrent(void)' */ +int setgrent(void); +int getgrgid_r(gid_t, struct group *, char *, size_t, + struct group **); +int getgrnam_r(const char *, struct group *, char *, size_t, + struct group **); +#endif +#if __BSD_VISIBLE +int getgrent_r(struct group *, char *, size_t, struct group **); +int setgroupent(int); +#endif +__END_DECLS + +#endif /* !_GRP_H_ */ diff --git a/src/include.new/gssapi.h b/src/include.new/gssapi.h new file mode 100644 index 0000000..4935651 --- /dev/null +++ b/src/include.new/gssapi.h @@ -0,0 +1,788 @@ +/* + * Copyright (c) 1997 - 2003 Kungliga Tekniska H�gskolan + * (Royal Institute of Technology, Stockholm, Sweden). + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of the Institute nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* $Id$ */ + +#ifndef GSSAPI_H_ +#define GSSAPI_H_ + +/* + * First, include stddef.h to get size_t defined. + */ +#include + +#include + +/* + * Now define the three implementation-dependent types. + */ + +typedef u_int32_t OM_uint32; + +typedef u_int32_t gss_uint32; + +/* + * This is to avoid having to include + */ + +struct krb5_auth_context_data; + +struct Principal; + +/* typedef void *gss_name_t; */ + +typedef struct Principal *gss_name_t; + +typedef struct gss_ctx_id_t_desc_struct { + struct krb5_auth_context_data *auth_context; + gss_name_t source, target; + OM_uint32 flags; + enum { LOCAL = 1, OPEN = 2, + COMPAT_OLD_DES3 = 4, COMPAT_OLD_DES3_SELECTED = 8 } more_flags; + struct krb5_ticket *ticket; + time_t lifetime; +} gss_ctx_id_t_desc; + +typedef gss_ctx_id_t_desc *gss_ctx_id_t; + +typedef struct gss_OID_desc_struct { + OM_uint32 length; + void *elements; +} gss_OID_desc, *gss_OID; + +typedef struct gss_OID_set_desc_struct { + size_t count; + gss_OID elements; +} gss_OID_set_desc, *gss_OID_set; + +struct krb5_keytab_data; + +struct krb5_ccache_data; + +typedef int gss_cred_usage_t; + +typedef struct gss_cred_id_t_desc_struct { + gss_name_t principal; + struct krb5_keytab_data *keytab; + OM_uint32 lifetime; + gss_cred_usage_t usage; + gss_OID_set mechanisms; + struct krb5_ccache_data *ccache; +} gss_cred_id_t_desc; + +typedef gss_cred_id_t_desc *gss_cred_id_t; + +typedef struct gss_buffer_desc_struct { + size_t length; + void *value; +} gss_buffer_desc, *gss_buffer_t; + +typedef struct gss_channel_bindings_struct { + OM_uint32 initiator_addrtype; + gss_buffer_desc initiator_address; + OM_uint32 acceptor_addrtype; + gss_buffer_desc acceptor_address; + gss_buffer_desc application_data; +} *gss_channel_bindings_t; + +/* + * For now, define a QOP-type as an OM_uint32 + */ +typedef OM_uint32 gss_qop_t; + +/* + * Flag bits for context-level services. + */ +#define GSS_C_DELEG_FLAG 1 +#define GSS_C_MUTUAL_FLAG 2 +#define GSS_C_REPLAY_FLAG 4 +#define GSS_C_SEQUENCE_FLAG 8 +#define GSS_C_CONF_FLAG 16 +#define GSS_C_INTEG_FLAG 32 +#define GSS_C_ANON_FLAG 64 +#define GSS_C_PROT_READY_FLAG 128 +#define GSS_C_TRANS_FLAG 256 + +/* + * Credential usage options + */ +#define GSS_C_BOTH 0 +#define GSS_C_INITIATE 1 +#define GSS_C_ACCEPT 2 + +/* + * Status code types for gss_display_status + */ +#define GSS_C_GSS_CODE 1 +#define GSS_C_MECH_CODE 2 + +/* + * The constant definitions for channel-bindings address families + */ +#define GSS_C_AF_UNSPEC 0 +#define GSS_C_AF_LOCAL 1 +#define GSS_C_AF_INET 2 +#define GSS_C_AF_IMPLINK 3 +#define GSS_C_AF_PUP 4 +#define GSS_C_AF_CHAOS 5 +#define GSS_C_AF_NS 6 +#define GSS_C_AF_NBS 7 +#define GSS_C_AF_ECMA 8 +#define GSS_C_AF_DATAKIT 9 +#define GSS_C_AF_CCITT 10 +#define GSS_C_AF_SNA 11 +#define GSS_C_AF_DECnet 12 +#define GSS_C_AF_DLI 13 +#define GSS_C_AF_LAT 14 +#define GSS_C_AF_HYLINK 15 +#define GSS_C_AF_APPLETALK 16 +#define GSS_C_AF_BSC 17 +#define GSS_C_AF_DSS 18 +#define GSS_C_AF_OSI 19 +#define GSS_C_AF_X25 21 +#define GSS_C_AF_INET6 24 + +#define GSS_C_AF_NULLADDR 255 + +/* + * Various Null values + */ +#define GSS_C_NO_NAME ((gss_name_t) 0) +#define GSS_C_NO_BUFFER ((gss_buffer_t) 0) +#define GSS_C_NO_OID ((gss_OID) 0) +#define GSS_C_NO_OID_SET ((gss_OID_set) 0) +#define GSS_C_NO_CONTEXT ((gss_ctx_id_t) 0) +#define GSS_C_NO_CREDENTIAL ((gss_cred_id_t) 0) +#define GSS_C_NO_CHANNEL_BINDINGS ((gss_channel_bindings_t) 0) +#define GSS_C_EMPTY_BUFFER {0, NULL} + +/* + * Some alternate names for a couple of the above + * values. These are defined for V1 compatibility. + */ +#define GSS_C_NULL_OID GSS_C_NO_OID +#define GSS_C_NULL_OID_SET GSS_C_NO_OID_SET + +/* + * Define the default Quality of Protection for per-message + * services. Note that an implementation that offers multiple + * levels of QOP may define GSS_C_QOP_DEFAULT to be either zero + * (as done here) to mean "default protection", or to a specific + * explicit QOP value. However, a value of 0 should always be + * interpreted by a GSSAPI implementation as a request for the + * default protection level. + */ +#define GSS_C_QOP_DEFAULT 0 + +#define GSS_KRB5_CONF_C_QOP_DES 0x0100 +#define GSS_KRB5_CONF_C_QOP_DES3_KD 0x0200 + +/* + * Expiration time of 2^32-1 seconds means infinite lifetime for a + * credential or security context + */ +#define GSS_C_INDEFINITE 0xfffffffful + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * The implementation must reserve static storage for a + * gss_OID_desc object containing the value + * {10, (void *)"\x2a\x86\x48\x86\xf7\x12" + * "\x01\x02\x01\x01"}, + * corresponding to an object-identifier value of + * {iso(1) member-body(2) United States(840) mit(113554) + * infosys(1) gssapi(2) generic(1) user_name(1)}. The constant + * GSS_C_NT_USER_NAME should be initialized to point + * to that gss_OID_desc. + */ +extern gss_OID GSS_C_NT_USER_NAME; + +/* + * The implementation must reserve static storage for a + * gss_OID_desc object containing the value + * {10, (void *)"\x2a\x86\x48\x86\xf7\x12" + * "\x01\x02\x01\x02"}, + * corresponding to an object-identifier value of + * {iso(1) member-body(2) United States(840) mit(113554) + * infosys(1) gssapi(2) generic(1) machine_uid_name(2)}. + * The constant GSS_C_NT_MACHINE_UID_NAME should be + * initialized to point to that gss_OID_desc. + */ +extern gss_OID GSS_C_NT_MACHINE_UID_NAME; + +/* + * The implementation must reserve static storage for a + * gss_OID_desc object containing the value + * {10, (void *)"\x2a\x86\x48\x86\xf7\x12" + * "\x01\x02\x01\x03"}, + * corresponding to an object-identifier value of + * {iso(1) member-body(2) United States(840) mit(113554) + * infosys(1) gssapi(2) generic(1) string_uid_name(3)}. + * The constant GSS_C_NT_STRING_UID_NAME should be + * initialized to point to that gss_OID_desc. + */ +extern gss_OID GSS_C_NT_STRING_UID_NAME; + +/* + * The implementation must reserve static storage for a + * gss_OID_desc object containing the value + * {6, (void *)"\x2b\x06\x01\x05\x06\x02"}, + * corresponding to an object-identifier value of + * {iso(1) org(3) dod(6) internet(1) security(5) + * nametypes(6) gss-host-based-services(2)). The constant + * GSS_C_NT_HOSTBASED_SERVICE_X should be initialized to point + * to that gss_OID_desc. This is a deprecated OID value, and + * implementations wishing to support hostbased-service names + * should instead use the GSS_C_NT_HOSTBASED_SERVICE OID, + * defined below, to identify such names; + * GSS_C_NT_HOSTBASED_SERVICE_X should be accepted a synonym + * for GSS_C_NT_HOSTBASED_SERVICE when presented as an input + * parameter, but should not be emitted by GSS-API + * implementations + */ +extern gss_OID GSS_C_NT_HOSTBASED_SERVICE_X; + +/* + * The implementation must reserve static storage for a + * gss_OID_desc object containing the value + * {10, (void *)"\x2a\x86\x48\x86\xf7\x12" + * "\x01\x02\x01\x04"}, corresponding to an + * object-identifier value of {iso(1) member-body(2) + * Unites States(840) mit(113554) infosys(1) gssapi(2) + * generic(1) service_name(4)}. The constant + * GSS_C_NT_HOSTBASED_SERVICE should be initialized + * to point to that gss_OID_desc. + */ +extern gss_OID GSS_C_NT_HOSTBASED_SERVICE; + +/* + * The implementation must reserve static storage for a + * gss_OID_desc object containing the value + * {6, (void *)"\x2b\x06\01\x05\x06\x03"}, + * corresponding to an object identifier value of + * {1(iso), 3(org), 6(dod), 1(internet), 5(security), + * 6(nametypes), 3(gss-anonymous-name)}. The constant + * and GSS_C_NT_ANONYMOUS should be initialized to point + * to that gss_OID_desc. + */ +extern gss_OID GSS_C_NT_ANONYMOUS; + +/* + * The implementation must reserve static storage for a + * gss_OID_desc object containing the value + * {6, (void *)"\x2b\x06\x01\x05\x06\x04"}, + * corresponding to an object-identifier value of + * {1(iso), 3(org), 6(dod), 1(internet), 5(security), + * 6(nametypes), 4(gss-api-exported-name)}. The constant + * GSS_C_NT_EXPORT_NAME should be initialized to point + * to that gss_OID_desc. + */ +extern gss_OID GSS_C_NT_EXPORT_NAME; + +/* + * This if for kerberos5 names. + */ + +extern gss_OID GSS_KRB5_NT_PRINCIPAL_NAME; +extern gss_OID GSS_KRB5_NT_USER_NAME; +extern gss_OID GSS_KRB5_NT_MACHINE_UID_NAME; +extern gss_OID GSS_KRB5_NT_STRING_UID_NAME; + +extern gss_OID GSS_KRB5_MECHANISM; + +/* for compatibility with MIT api */ + +#define gss_mech_krb5 GSS_KRB5_MECHANISM + +/* Major status codes */ + +#define GSS_S_COMPLETE 0 + +/* + * Some "helper" definitions to make the status code macros obvious. + */ +#define GSS_C_CALLING_ERROR_OFFSET 24 +#define GSS_C_ROUTINE_ERROR_OFFSET 16 +#define GSS_C_SUPPLEMENTARY_OFFSET 0 +#define GSS_C_CALLING_ERROR_MASK 0377ul +#define GSS_C_ROUTINE_ERROR_MASK 0377ul +#define GSS_C_SUPPLEMENTARY_MASK 0177777ul + +/* + * The macros that test status codes for error conditions. + * Note that the GSS_ERROR() macro has changed slightly from + * the V1 GSSAPI so that it now evaluates its argument + * only once. + */ +#define GSS_CALLING_ERROR(x) \ + (x & (GSS_C_CALLING_ERROR_MASK << GSS_C_CALLING_ERROR_OFFSET)) +#define GSS_ROUTINE_ERROR(x) \ + (x & (GSS_C_ROUTINE_ERROR_MASK << GSS_C_ROUTINE_ERROR_OFFSET)) +#define GSS_SUPPLEMENTARY_INFO(x) \ + (x & (GSS_C_SUPPLEMENTARY_MASK << GSS_C_SUPPLEMENTARY_OFFSET)) +#define GSS_ERROR(x) \ + (x & ((GSS_C_CALLING_ERROR_MASK << GSS_C_CALLING_ERROR_OFFSET) | \ + (GSS_C_ROUTINE_ERROR_MASK << GSS_C_ROUTINE_ERROR_OFFSET))) + +/* + * Now the actual status code definitions + */ + +/* + * Calling errors: + */ +#define GSS_S_CALL_INACCESSIBLE_READ \ + (1ul << GSS_C_CALLING_ERROR_OFFSET) +#define GSS_S_CALL_INACCESSIBLE_WRITE \ + (2ul << GSS_C_CALLING_ERROR_OFFSET) +#define GSS_S_CALL_BAD_STRUCTURE \ + (3ul << GSS_C_CALLING_ERROR_OFFSET) + +/* + * Routine errors: + */ +#define GSS_S_BAD_MECH (1ul << GSS_C_ROUTINE_ERROR_OFFSET) +#define GSS_S_BAD_NAME (2ul << GSS_C_ROUTINE_ERROR_OFFSET) +#define GSS_S_BAD_NAMETYPE (3ul << GSS_C_ROUTINE_ERROR_OFFSET) + +#define GSS_S_BAD_BINDINGS (4ul << GSS_C_ROUTINE_ERROR_OFFSET) +#define GSS_S_BAD_STATUS (5ul << GSS_C_ROUTINE_ERROR_OFFSET) +#define GSS_S_BAD_SIG (6ul << GSS_C_ROUTINE_ERROR_OFFSET) +#define GSS_S_BAD_MIC GSS_S_BAD_SIG +#define GSS_S_NO_CRED (7ul << GSS_C_ROUTINE_ERROR_OFFSET) +#define GSS_S_NO_CONTEXT (8ul << GSS_C_ROUTINE_ERROR_OFFSET) +#define GSS_S_DEFECTIVE_TOKEN (9ul << GSS_C_ROUTINE_ERROR_OFFSET) +#define GSS_S_DEFECTIVE_CREDENTIAL (10ul << GSS_C_ROUTINE_ERROR_OFFSET) +#define GSS_S_CREDENTIALS_EXPIRED (11ul << GSS_C_ROUTINE_ERROR_OFFSET) +#define GSS_S_CONTEXT_EXPIRED (12ul << GSS_C_ROUTINE_ERROR_OFFSET) +#define GSS_S_FAILURE (13ul << GSS_C_ROUTINE_ERROR_OFFSET) +#define GSS_S_BAD_QOP (14ul << GSS_C_ROUTINE_ERROR_OFFSET) +#define GSS_S_UNAUTHORIZED (15ul << GSS_C_ROUTINE_ERROR_OFFSET) +#define GSS_S_UNAVAILABLE (16ul << GSS_C_ROUTINE_ERROR_OFFSET) +#define GSS_S_DUPLICATE_ELEMENT (17ul << GSS_C_ROUTINE_ERROR_OFFSET) +#define GSS_S_NAME_NOT_MN (18ul << GSS_C_ROUTINE_ERROR_OFFSET) + +/* + * Supplementary info bits: + */ +#define GSS_S_CONTINUE_NEEDED (1ul << (GSS_C_SUPPLEMENTARY_OFFSET + 0)) +#define GSS_S_DUPLICATE_TOKEN (1ul << (GSS_C_SUPPLEMENTARY_OFFSET + 1)) +#define GSS_S_OLD_TOKEN (1ul << (GSS_C_SUPPLEMENTARY_OFFSET + 2)) +#define GSS_S_UNSEQ_TOKEN (1ul << (GSS_C_SUPPLEMENTARY_OFFSET + 3)) +#define GSS_S_GAP_TOKEN (1ul << (GSS_C_SUPPLEMENTARY_OFFSET + 4)) + +/* + * From RFC1964: + * + * 4.1.1. Non-Kerberos-specific codes + */ + +#define GSS_KRB5_S_G_BAD_SERVICE_NAME 1 + /* "No @ in SERVICE-NAME name string" */ +#define GSS_KRB5_S_G_BAD_STRING_UID 2 + /* "STRING-UID-NAME contains nondigits" */ +#define GSS_KRB5_S_G_NOUSER 3 + /* "UID does not resolve to username" */ +#define GSS_KRB5_S_G_VALIDATE_FAILED 4 + /* "Validation error" */ +#define GSS_KRB5_S_G_BUFFER_ALLOC 5 + /* "Couldn't allocate gss_buffer_t data" */ +#define GSS_KRB5_S_G_BAD_MSG_CTX 6 + /* "Message context invalid" */ +#define GSS_KRB5_S_G_WRONG_SIZE 7 + /* "Buffer is the wrong size" */ +#define GSS_KRB5_S_G_BAD_USAGE 8 + /* "Credential usage type is unknown" */ +#define GSS_KRB5_S_G_UNKNOWN_QOP 9 + /* "Unknown quality of protection specified" */ + + /* + * 4.1.2. Kerberos-specific-codes + */ + +#define GSS_KRB5_S_KG_CCACHE_NOMATCH 10 + /* "Principal in credential cache does not match desired name" */ +#define GSS_KRB5_S_KG_KEYTAB_NOMATCH 11 + /* "No principal in keytab matches desired name" */ +#define GSS_KRB5_S_KG_TGT_MISSING 12 + /* "Credential cache has no TGT" */ +#define GSS_KRB5_S_KG_NO_SUBKEY 13 + /* "Authenticator has no subkey" */ +#define GSS_KRB5_S_KG_CONTEXT_ESTABLISHED 14 + /* "Context is already fully established" */ +#define GSS_KRB5_S_KG_BAD_SIGN_TYPE 15 + /* "Unknown signature type in token" */ +#define GSS_KRB5_S_KG_BAD_LENGTH 16 + /* "Invalid field length in token" */ +#define GSS_KRB5_S_KG_CTX_INCOMPLETE 17 + /* "Attempt to use incomplete security context" */ + +/* + * Finally, function prototypes for the GSS-API routines. + */ + +OM_uint32 gss_acquire_cred + (OM_uint32 * /*minor_status*/, + const gss_name_t /*desired_name*/, + OM_uint32 /*time_req*/, + const gss_OID_set /*desired_mechs*/, + gss_cred_usage_t /*cred_usage*/, + gss_cred_id_t * /*output_cred_handle*/, + gss_OID_set * /*actual_mechs*/, + OM_uint32 * /*time_rec*/ + ); + +OM_uint32 gss_release_cred + (OM_uint32 * /*minor_status*/, + gss_cred_id_t * /*cred_handle*/ + ); + +OM_uint32 gss_init_sec_context + (OM_uint32 * /*minor_status*/, + const gss_cred_id_t /*initiator_cred_handle*/, + gss_ctx_id_t * /*context_handle*/, + const gss_name_t /*target_name*/, + const gss_OID /*mech_type*/, + OM_uint32 /*req_flags*/, + OM_uint32 /*time_req*/, + const gss_channel_bindings_t /*input_chan_bindings*/, + const gss_buffer_t /*input_token*/, + gss_OID * /*actual_mech_type*/, + gss_buffer_t /*output_token*/, + OM_uint32 * /*ret_flags*/, + OM_uint32 * /*time_rec*/ + ); + +OM_uint32 gss_accept_sec_context + (OM_uint32 * /*minor_status*/, + gss_ctx_id_t * /*context_handle*/, + const gss_cred_id_t /*acceptor_cred_handle*/, + const gss_buffer_t /*input_token_buffer*/, + const gss_channel_bindings_t /*input_chan_bindings*/, + gss_name_t * /*src_name*/, + gss_OID * /*mech_type*/, + gss_buffer_t /*output_token*/, + OM_uint32 * /*ret_flags*/, + OM_uint32 * /*time_rec*/, + gss_cred_id_t * /*delegated_cred_handle*/ + ); + +OM_uint32 gss_process_context_token + (OM_uint32 * /*minor_status*/, + const gss_ctx_id_t /*context_handle*/, + const gss_buffer_t /*token_buffer*/ + ); + +OM_uint32 gss_delete_sec_context + (OM_uint32 * /*minor_status*/, + gss_ctx_id_t * /*context_handle*/, + gss_buffer_t /*output_token*/ + ); + +OM_uint32 gss_context_time + (OM_uint32 * /*minor_status*/, + const gss_ctx_id_t /*context_handle*/, + OM_uint32 * /*time_rec*/ + ); + +OM_uint32 gss_get_mic + (OM_uint32 * /*minor_status*/, + const gss_ctx_id_t /*context_handle*/, + gss_qop_t /*qop_req*/, + const gss_buffer_t /*message_buffer*/, + gss_buffer_t /*message_token*/ + ); + +OM_uint32 gss_verify_mic + (OM_uint32 * /*minor_status*/, + const gss_ctx_id_t /*context_handle*/, + const gss_buffer_t /*message_buffer*/, + const gss_buffer_t /*token_buffer*/, + gss_qop_t * /*qop_state*/ + ); + +OM_uint32 gss_wrap + (OM_uint32 * /*minor_status*/, + const gss_ctx_id_t /*context_handle*/, + int /*conf_req_flag*/, + gss_qop_t /*qop_req*/, + const gss_buffer_t /*input_message_buffer*/, + int * /*conf_state*/, + gss_buffer_t /*output_message_buffer*/ + ); + +OM_uint32 gss_unwrap + (OM_uint32 * /*minor_status*/, + const gss_ctx_id_t /*context_handle*/, + const gss_buffer_t /*input_message_buffer*/, + gss_buffer_t /*output_message_buffer*/, + int * /*conf_state*/, + gss_qop_t * /*qop_state*/ + ); + +OM_uint32 gss_display_status + (OM_uint32 * /*minor_status*/, + OM_uint32 /*status_value*/, + int /*status_type*/, + const gss_OID /*mech_type*/, + OM_uint32 * /*message_context*/, + gss_buffer_t /*status_string*/ + ); + +OM_uint32 gss_indicate_mechs + (OM_uint32 * /*minor_status*/, + gss_OID_set * /*mech_set*/ + ); + +OM_uint32 gss_compare_name + (OM_uint32 * /*minor_status*/, + const gss_name_t /*name1*/, + const gss_name_t /*name2*/, + int * /*name_equal*/ + ); + +OM_uint32 gss_display_name + (OM_uint32 * /*minor_status*/, + const gss_name_t /*input_name*/, + gss_buffer_t /*output_name_buffer*/, + gss_OID * /*output_name_type*/ + ); + +OM_uint32 gss_import_name + (OM_uint32 * /*minor_status*/, + const gss_buffer_t /*input_name_buffer*/, + const gss_OID /*input_name_type*/, + gss_name_t * /*output_name*/ + ); + +OM_uint32 gss_export_name + (OM_uint32 * /*minor_status*/, + const gss_name_t /*input_name*/, + gss_buffer_t /*exported_name*/ + ); + +OM_uint32 gss_release_name + (OM_uint32 * /*minor_status*/, + gss_name_t * /*input_name*/ + ); + +OM_uint32 gss_release_buffer + (OM_uint32 * /*minor_status*/, + gss_buffer_t /*buffer*/ + ); + +OM_uint32 gss_release_oid_set + (OM_uint32 * /*minor_status*/, + gss_OID_set * /*set*/ + ); + +OM_uint32 gss_inquire_cred + (OM_uint32 * /*minor_status*/, + const gss_cred_id_t /*cred_handle*/, + gss_name_t * /*name*/, + OM_uint32 * /*lifetime*/, + gss_cred_usage_t * /*cred_usage*/, + gss_OID_set * /*mechanisms*/ + ); + +OM_uint32 gss_inquire_context ( + OM_uint32 * /*minor_status*/, + const gss_ctx_id_t /*context_handle*/, + gss_name_t * /*src_name*/, + gss_name_t * /*targ_name*/, + OM_uint32 * /*lifetime_rec*/, + gss_OID * /*mech_type*/, + OM_uint32 * /*ctx_flags*/, + int * /*locally_initiated*/, + int * /*open_context*/ + ); + +OM_uint32 gss_wrap_size_limit ( + OM_uint32 * /*minor_status*/, + const gss_ctx_id_t /*context_handle*/, + int /*conf_req_flag*/, + gss_qop_t /*qop_req*/, + OM_uint32 /*req_output_size*/, + OM_uint32 * /*max_input_size*/ + ); + +OM_uint32 gss_add_cred ( + OM_uint32 * /*minor_status*/, + const gss_cred_id_t /*input_cred_handle*/, + const gss_name_t /*desired_name*/, + const gss_OID /*desired_mech*/, + gss_cred_usage_t /*cred_usage*/, + OM_uint32 /*initiator_time_req*/, + OM_uint32 /*acceptor_time_req*/, + gss_cred_id_t * /*output_cred_handle*/, + gss_OID_set * /*actual_mechs*/, + OM_uint32 * /*initiator_time_rec*/, + OM_uint32 * /*acceptor_time_rec*/ + ); + +OM_uint32 gss_inquire_cred_by_mech ( + OM_uint32 * /*minor_status*/, + const gss_cred_id_t /*cred_handle*/, + const gss_OID /*mech_type*/, + gss_name_t * /*name*/, + OM_uint32 * /*initiator_lifetime*/, + OM_uint32 * /*acceptor_lifetime*/, + gss_cred_usage_t * /*cred_usage*/ + ); + +OM_uint32 gss_export_sec_context ( + OM_uint32 * /*minor_status*/, + gss_ctx_id_t * /*context_handle*/, + gss_buffer_t /*interprocess_token*/ + ); + +OM_uint32 gss_import_sec_context ( + OM_uint32 * /*minor_status*/, + const gss_buffer_t /*interprocess_token*/, + gss_ctx_id_t * /*context_handle*/ + ); + +OM_uint32 gss_create_empty_oid_set ( + OM_uint32 * /*minor_status*/, + gss_OID_set * /*oid_set*/ + ); + +OM_uint32 gss_add_oid_set_member ( + OM_uint32 * /*minor_status*/, + const gss_OID /*member_oid*/, + gss_OID_set * /*oid_set*/ + ); + +OM_uint32 gss_test_oid_set_member ( + OM_uint32 * /*minor_status*/, + const gss_OID /*member*/, + const gss_OID_set /*set*/, + int * /*present*/ + ); + +OM_uint32 gss_inquire_names_for_mech ( + OM_uint32 * /*minor_status*/, + const gss_OID /*mechanism*/, + gss_OID_set * /*name_types*/ + ); + +OM_uint32 gss_inquire_mechs_for_name ( + OM_uint32 * /*minor_status*/, + const gss_name_t /*input_name*/, + gss_OID_set * /*mech_types*/ + ); + +OM_uint32 gss_canonicalize_name ( + OM_uint32 * /*minor_status*/, + const gss_name_t /*input_name*/, + const gss_OID /*mech_type*/, + gss_name_t * /*output_name*/ + ); + +OM_uint32 gss_duplicate_name ( + OM_uint32 * /*minor_status*/, + const gss_name_t /*src_name*/, + gss_name_t * /*dest_name*/ + ); + +/* + * The following routines are obsolete variants of gss_get_mic, + * gss_verify_mic, gss_wrap and gss_unwrap. They should be + * provided by GSSAPI V2 implementations for backwards + * compatibility with V1 applications. Distinct entrypoints + * (as opposed to #defines) should be provided, both to allow + * GSSAPI V1 applications to link against GSSAPI V2 implementations, + * and to retain the slight parameter type differences between the + * obsolete versions of these routines and their current forms. + */ + +OM_uint32 gss_sign + (OM_uint32 * /*minor_status*/, + gss_ctx_id_t /*context_handle*/, + int /*qop_req*/, + gss_buffer_t /*message_buffer*/, + gss_buffer_t /*message_token*/ + ); + +OM_uint32 gss_verify + (OM_uint32 * /*minor_status*/, + gss_ctx_id_t /*context_handle*/, + gss_buffer_t /*message_buffer*/, + gss_buffer_t /*token_buffer*/, + int * /*qop_state*/ + ); + +OM_uint32 gss_seal + (OM_uint32 * /*minor_status*/, + gss_ctx_id_t /*context_handle*/, + int /*conf_req_flag*/, + int /*qop_req*/, + gss_buffer_t /*input_message_buffer*/, + int * /*conf_state*/, + gss_buffer_t /*output_message_buffer*/ + ); + +OM_uint32 gss_unseal + (OM_uint32 * /*minor_status*/, + gss_ctx_id_t /*context_handle*/, + gss_buffer_t /*input_message_buffer*/, + gss_buffer_t /*output_message_buffer*/, + int * /*conf_state*/, + int * /*qop_state*/ + ); + +/* + * kerberos mechanism specific functions + */ + +OM_uint32 gsskrb5_register_acceptor_identity + (const char */*identity*/); + +OM_uint32 gss_krb5_copy_ccache + (OM_uint32 */*minor*/, + gss_cred_id_t /*cred*/, + struct krb5_ccache_data */*out*/); + +#define GSS_C_KRB5_COMPAT_DES3_MIC 1 + +OM_uint32 +gss_krb5_compat_des3_mic(OM_uint32 *, gss_ctx_id_t, int); + +#ifdef __cplusplus +} +#endif + +#endif /* GSSAPI_H_ */ diff --git a/src/include.new/hdb-private.h b/src/include.new/hdb-private.h new file mode 100644 index 0000000..a47de70 --- /dev/null +++ b/src/include.new/hdb-private.h @@ -0,0 +1,27 @@ +/* This is a generated file */ +#ifndef __hdb_private_h__ +#define __hdb_private_h__ + +#include + +krb5_error_code +_hdb_fetch ( + krb5_context /*context*/, + HDB */*db*/, + unsigned /*flags*/, + hdb_entry */*entry*/); + +krb5_error_code +_hdb_remove ( + krb5_context /*context*/, + HDB */*db*/, + hdb_entry */*entry*/); + +krb5_error_code +_hdb_store ( + krb5_context /*context*/, + HDB */*db*/, + unsigned /*flags*/, + hdb_entry */*entry*/); + +#endif /* __hdb_private_h__ */ diff --git a/src/include.new/hdb-protos.h b/src/include.new/hdb-protos.h new file mode 100644 index 0000000..ce85fcb --- /dev/null +++ b/src/include.new/hdb-protos.h @@ -0,0 +1,188 @@ +/* This is a generated file */ +#ifndef __hdb_protos_h__ +#define __hdb_protos_h__ + +#include + +krb5_error_code +hdb_add_master_key ( + krb5_context /*context*/, + krb5_keyblock */*key*/, + hdb_master_key */*inout*/); + +krb5_error_code +hdb_check_db_format ( + krb5_context /*context*/, + HDB */*db*/); + +krb5_error_code +hdb_clear_master_key ( + krb5_context /*context*/, + HDB */*db*/); + +krb5_error_code +hdb_create ( + krb5_context /*context*/, + HDB **/*db*/, + const char */*filename*/); + +krb5_error_code +hdb_db_create ( + krb5_context /*context*/, + HDB **/*db*/, + const char */*filename*/); + +krb5_error_code +hdb_enctype2key ( + krb5_context /*context*/, + hdb_entry */*e*/, + krb5_enctype /*enctype*/, + Key **/*key*/); + +krb5_error_code +hdb_entry2string ( + krb5_context /*context*/, + hdb_entry */*ent*/, + char **/*str*/); + +int +hdb_entry2value ( + krb5_context /*context*/, + hdb_entry */*ent*/, + krb5_data */*value*/); + +krb5_error_code +hdb_foreach ( + krb5_context /*context*/, + HDB */*db*/, + unsigned /*flags*/, + hdb_foreach_func_t /*func*/, + void */*data*/); + +void +hdb_free_entry ( + krb5_context /*context*/, + hdb_entry */*ent*/); + +void +hdb_free_key (Key */*key*/); + +void +hdb_free_master_key ( + krb5_context /*context*/, + hdb_master_key /*mkey*/); + +krb5_error_code +hdb_init_db ( + krb5_context /*context*/, + HDB */*db*/); + +int +hdb_key2principal ( + krb5_context /*context*/, + krb5_data */*key*/, + krb5_principal /*p*/); + +krb5_error_code +hdb_ldap_create ( + krb5_context /*context*/, + HDB ** /*db*/, + const char */*arg*/); + +krb5_error_code +hdb_lock ( + int /*fd*/, + int /*operation*/); + +krb5_error_code +hdb_ndbm_create ( + krb5_context /*context*/, + HDB **/*db*/, + const char */*filename*/); + +krb5_error_code +hdb_next_enctype2key ( + krb5_context /*context*/, + const hdb_entry */*e*/, + krb5_enctype /*enctype*/, + Key **/*key*/); + +int +hdb_principal2key ( + krb5_context /*context*/, + krb5_principal /*p*/, + krb5_data */*key*/); + +krb5_error_code +hdb_print_entry ( + krb5_context /*context*/, + HDB */*db*/, + hdb_entry */*entry*/, + void */*data*/); + +krb5_error_code +hdb_process_master_key ( + krb5_context /*context*/, + int /*kvno*/, + krb5_keyblock */*key*/, + krb5_enctype /*etype*/, + hdb_master_key */*mkey*/); + +krb5_error_code +hdb_read_master_key ( + krb5_context /*context*/, + const char */*filename*/, + hdb_master_key */*mkey*/); + +krb5_error_code +hdb_seal_keys ( + krb5_context /*context*/, + HDB */*db*/, + hdb_entry */*ent*/); + +krb5_error_code +hdb_seal_keys_mkey ( + krb5_context /*context*/, + hdb_entry */*ent*/, + hdb_master_key /*mkey*/); + +krb5_error_code +hdb_set_master_key ( + krb5_context /*context*/, + HDB */*db*/, + krb5_keyblock */*key*/); + +krb5_error_code +hdb_set_master_keyfile ( + krb5_context /*context*/, + HDB */*db*/, + const char */*keyfile*/); + +krb5_error_code +hdb_unlock (int /*fd*/); + +krb5_error_code +hdb_unseal_keys ( + krb5_context /*context*/, + HDB */*db*/, + hdb_entry */*ent*/); + +krb5_error_code +hdb_unseal_keys_mkey ( + krb5_context /*context*/, + hdb_entry */*ent*/, + hdb_master_key /*mkey*/); + +int +hdb_value2entry ( + krb5_context /*context*/, + krb5_data */*value*/, + hdb_entry */*ent*/); + +krb5_error_code +hdb_write_master_key ( + krb5_context /*context*/, + const char */*filename*/, + hdb_master_key /*mkey*/); + +#endif /* __hdb_protos_h__ */ diff --git a/src/include.new/hdb.h b/src/include.new/hdb.h new file mode 100644 index 0000000..ed836fa --- /dev/null +++ b/src/include.new/hdb.h @@ -0,0 +1,91 @@ +/* + * Copyright (c) 1997 - 2000 Kungliga Tekniska H�gskolan + * (Royal Institute of Technology, Stockholm, Sweden). + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of the Institute nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* $Id$ */ + +#ifndef __HDB_H__ +#define __HDB_H__ + +#include + +#include + +enum hdb_lockop{ HDB_RLOCK, HDB_WLOCK }; + +/* flags for various functions */ +#define HDB_F_DECRYPT 1 /* decrypt keys */ +#define HDB_F_REPLACE 2 /* replace entry */ + +/* key usage for master key */ +#define HDB_KU_MKEY 0x484442 + +typedef struct hdb_master_key_data *hdb_master_key; + +typedef struct HDB{ + void *db; + void *dbc; + char *name; + int master_key_set; + hdb_master_key master_key; + int openp; + + krb5_error_code (*open)(krb5_context, struct HDB*, int, mode_t); + krb5_error_code (*close)(krb5_context, struct HDB*); + krb5_error_code (*fetch)(krb5_context, struct HDB*, unsigned, hdb_entry*); + krb5_error_code (*store)(krb5_context, struct HDB*, unsigned, hdb_entry*); + krb5_error_code (*remove)(krb5_context, struct HDB*, hdb_entry*); + krb5_error_code (*firstkey)(krb5_context, struct HDB*, + unsigned, hdb_entry*); + krb5_error_code (*nextkey)(krb5_context, struct HDB*, + unsigned, hdb_entry*); + krb5_error_code (*lock)(krb5_context, struct HDB*, int operation); + krb5_error_code (*unlock)(krb5_context, struct HDB*); + krb5_error_code (*rename)(krb5_context, struct HDB*, const char*); + krb5_error_code (*_get)(krb5_context, struct HDB*, krb5_data, krb5_data*); + krb5_error_code (*_put)(krb5_context, struct HDB*, int, + krb5_data, krb5_data); + krb5_error_code (*_del)(krb5_context, struct HDB*, krb5_data); + krb5_error_code (*destroy)(krb5_context, struct HDB*); +}HDB; + +#define HDB_DB_DIR "/var/heimdal" +#define HDB_DEFAULT_DB HDB_DB_DIR "/heimdal" +#define HDB_DB_FORMAT_ENTRY "hdb/db-format" + +typedef krb5_error_code (*hdb_foreach_func_t)(krb5_context, HDB*, + hdb_entry*, void*); +extern krb5_kt_ops hdb_kt_ops; + +#include + +#endif /* __HDB_H__ */ diff --git a/src/include.new/hdb_asn1.h b/src/include.new/hdb_asn1.h new file mode 100644 index 0000000..37e13d0 --- /dev/null +++ b/src/include.new/hdb_asn1.h @@ -0,0 +1,222 @@ +/* Generated from /usr/src/kerberos5/lib/libhdb/../../../crypto/heimdal/lib/hdb/hdb.asn1 */ +/* Do not edit */ + +#ifndef __hdb_asn1_h__ +#define __hdb_asn1_h__ + +#include +#include + +#ifndef __asn1_common_definitions__ +#define __asn1_common_definitions__ + +typedef struct octet_string { + size_t length; + void *data; +} octet_string; + +typedef char *general_string; + +typedef struct oid { + size_t length; + unsigned *components; +} oid; + +#define ASN1_MALLOC_ENCODE(T, B, BL, S, L, R) \ + do { \ + (BL) = length_##T((S)); \ + (B) = malloc((BL)); \ + if((B) == NULL) { \ + (R) = ENOMEM; \ + } else { \ + (R) = encode_##T(((unsigned char*)(B)) + (BL) - 1, (BL), \ + (S), (L)); \ + if((R) != 0) { \ + free((B)); \ + (B) = NULL; \ + } \ + } \ + } while (0) + +#endif + +enum { HDB_DB_FORMAT = 2 }; + +enum { hdb_pw_salt = 3 }; + +enum { hdb_afs3_salt = 10 }; + +/* +Salt ::= SEQUENCE { + type[0] INTEGER, + salt[1] OCTET STRING +} +*/ + +typedef struct Salt { + int type; + octet_string salt; +} Salt; + +int encode_Salt(unsigned char *, size_t, const Salt *, size_t *); +int decode_Salt(const unsigned char *, size_t, Salt *, size_t *); +void free_Salt (Salt *); +size_t length_Salt(const Salt *); +int copy_Salt (const Salt *, Salt *); + + +/* +Key ::= SEQUENCE { + mkvno[0] INTEGER OPTIONAL, + key[1] EncryptionKey, + salt[2] Salt OPTIONAL +} +*/ + +typedef struct Key { + int *mkvno; + EncryptionKey key; + Salt *salt; +} Key; + +int encode_Key(unsigned char *, size_t, const Key *, size_t *); +int decode_Key(const unsigned char *, size_t, Key *, size_t *); +void free_Key (Key *); +size_t length_Key(const Key *); +int copy_Key (const Key *, Key *); + + +/* +Event ::= SEQUENCE { + time[0] KerberosTime, + principal[1] Principal OPTIONAL +} +*/ + +typedef struct Event { + KerberosTime time; + Principal *principal; +} Event; + +int encode_Event(unsigned char *, size_t, const Event *, size_t *); +int decode_Event(const unsigned char *, size_t, Event *, size_t *); +void free_Event (Event *); +size_t length_Event(const Event *); +int copy_Event (const Event *, Event *); + + +/* +HDBFlags ::= BIT STRING { + initial(0), + forwardable(1), + proxiable(2), + renewable(3), + postdate(4), + server(5), + client(6), + invalid(7), + require-preauth(8), + change-pw(9), + require-hwauth(10), + ok-as-delegate(11), + user-to-user(12), + immutable(13) +} +*/ + +typedef struct HDBFlags { + unsigned int initial:1; + unsigned int forwardable:1; + unsigned int proxiable:1; + unsigned int renewable:1; + unsigned int postdate:1; + unsigned int server:1; + unsigned int client:1; + unsigned int invalid:1; + unsigned int require_preauth:1; + unsigned int change_pw:1; + unsigned int require_hwauth:1; + unsigned int ok_as_delegate:1; + unsigned int user_to_user:1; + unsigned int immutable:1; +} HDBFlags; + + +int encode_HDBFlags(unsigned char *, size_t, const HDBFlags *, size_t *); +int decode_HDBFlags(const unsigned char *, size_t, HDBFlags *, size_t *); +void free_HDBFlags (HDBFlags *); +size_t length_HDBFlags(const HDBFlags *); +int copy_HDBFlags (const HDBFlags *, HDBFlags *); +unsigned HDBFlags2int(HDBFlags); +HDBFlags int2HDBFlags(unsigned); +extern struct units HDBFlags_units[]; + +/* +GENERATION ::= SEQUENCE { + time[0] KerberosTime, + usec[1] INTEGER, + gen[2] INTEGER +} +*/ + +typedef struct GENERATION { + KerberosTime time; + int usec; + int gen; +} GENERATION; + +int encode_GENERATION(unsigned char *, size_t, const GENERATION *, size_t *); +int decode_GENERATION(const unsigned char *, size_t, GENERATION *, size_t *); +void free_GENERATION (GENERATION *); +size_t length_GENERATION(const GENERATION *); +int copy_GENERATION (const GENERATION *, GENERATION *); + + +/* +hdb_entry ::= SEQUENCE { + principal[0] Principal OPTIONAL, + kvno[1] INTEGER, + keys[2] SEQUENCE OF Key, + created-by[3] Event, + modified-by[4] Event OPTIONAL, + valid-start[5] KerberosTime OPTIONAL, + valid-end[6] KerberosTime OPTIONAL, + pw-end[7] KerberosTime OPTIONAL, + max-life[8] INTEGER OPTIONAL, + max-renew[9] INTEGER OPTIONAL, + flags[10] HDBFlags, + etypes[11] SEQUENCE OF INTEGER OPTIONAL, + generation[12] GENERATION OPTIONAL +} +*/ + +typedef struct hdb_entry { + Principal *principal; + int kvno; + struct { + unsigned int len; + Key *val; + } keys; + Event created_by; + Event *modified_by; + KerberosTime *valid_start; + KerberosTime *valid_end; + KerberosTime *pw_end; + int *max_life; + int *max_renew; + HDBFlags flags; + struct { + unsigned int len; + int *val; + } *etypes; + GENERATION *generation; +} hdb_entry; + +int encode_hdb_entry(unsigned char *, size_t, const hdb_entry *, size_t *); +int decode_hdb_entry(const unsigned char *, size_t, hdb_entry *, size_t *); +void free_hdb_entry (hdb_entry *); +size_t length_hdb_entry(const hdb_entry *); +int copy_hdb_entry (const hdb_entry *, hdb_entry *); + + +#endif /* __hdb_asn1_h__ */ diff --git a/src/include.new/hdb_err.h b/src/include.new/hdb_err.h new file mode 100644 index 0000000..2304404 --- /dev/null +++ b/src/include.new/hdb_err.h @@ -0,0 +1,31 @@ +/* Generated from /usr/src/kerberos5/lib/libhdb/../../../crypto/heimdal/lib/hdb/hdb_err.et */ +/* $Id$ */ + +#ifndef __hdb_err_h__ +#define __hdb_err_h__ + +struct et_list; + +void initialize_hdb_error_table_r(struct et_list **); + +void initialize_hdb_error_table(void); +#define init_hdb_err_tbl initialize_hdb_error_table + +typedef enum hdb_error_number{ + HDB_ERR_UK_SERROR = 36150273, + HDB_ERR_UK_RERROR = 36150274, + HDB_ERR_NOENTRY = 36150275, + HDB_ERR_DB_INUSE = 36150276, + HDB_ERR_DB_CHANGED = 36150277, + HDB_ERR_RECURSIVELOCK = 36150278, + HDB_ERR_NOTLOCKED = 36150279, + HDB_ERR_BADLOCKMODE = 36150280, + HDB_ERR_CANT_LOCK_DB = 36150281, + HDB_ERR_EXISTS = 36150282, + HDB_ERR_BADVERSION = 36150283, + HDB_ERR_NO_MKEY = 36150284 +} hdb_error_number; + +#define ERROR_TABLE_BASE_hdb 36150272 + +#endif /* __hdb_err_h__ */ diff --git a/src/include.new/heim_err.h b/src/include.new/heim_err.h new file mode 100644 index 0000000..ad57e61 --- /dev/null +++ b/src/include.new/heim_err.h @@ -0,0 +1,39 @@ +/* Generated from /usr/src/kerberos5/lib/libkrb5/../../../crypto/heimdal/lib/krb5/heim_err.et */ +/* $Id$ */ + +#ifndef __heim_err_h__ +#define __heim_err_h__ + +struct et_list; + +void initialize_heim_error_table_r(struct et_list **); + +void initialize_heim_error_table(void); +#define init_heim_err_tbl initialize_heim_error_table + +typedef enum heim_error_number{ + HEIM_ERR_LOG_PARSE = -1980176640, + HEIM_ERR_V4_PRINC_NO_CONV = -1980176639, + HEIM_ERR_SALTTYPE_NOSUPP = -1980176638, + HEIM_ERR_NOHOST = -1980176637, + HEIM_ERR_OPNOTSUPP = -1980176636, + HEIM_ERR_EOF = -1980176635, + HEIM_ERR_BAD_MKEY = -1980176634, + HEIM_ERR_SERVICE_NOMATCH = -1980176633, + HEIM_EAI_UNKNOWN = -1980176512, + HEIM_EAI_ADDRFAMILY = -1980176511, + HEIM_EAI_AGAIN = -1980176510, + HEIM_EAI_BADFLAGS = -1980176509, + HEIM_EAI_FAIL = -1980176508, + HEIM_EAI_FAMILY = -1980176507, + HEIM_EAI_MEMORY = -1980176506, + HEIM_EAI_NODATA = -1980176505, + HEIM_EAI_NONAME = -1980176504, + HEIM_EAI_SERVICE = -1980176503, + HEIM_EAI_SOCKTYPE = -1980176502, + HEIM_EAI_SYSTEM = -1980176501 +} heim_error_number; + +#define ERROR_TABLE_BASE_heim -1980176640 + +#endif /* __heim_err_h__ */ diff --git a/src/include.new/hesiod.h b/src/include.new/hesiod.h new file mode 100644 index 0000000..c7dbeee --- /dev/null +++ b/src/include.new/hesiod.h @@ -0,0 +1,98 @@ +/* $NetBSD: hesiod.h,v 1.3 1999/01/24 23:53:18 lukem Exp $ */ +/* $FreeBSD: src/include/hesiod.h,v 1.2 2002/03/23 17:24:53 imp Exp $ */ + + +/*- + * Copyright (c) 1997, 1998, 1999 The NetBSD Foundation, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the NetBSD + * Foundation, Inc. and its contributors. + * 4. Neither the name of The NetBSD Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * Copyright (c) 1996 by Internet Software Consortium. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS + * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE + * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ + +#ifndef _HESIOD_H_ +#define _HESIOD_H_ + + /* Application-visible indication that we have the new interfaces */ + +#define HESIOD_INTERFACES + + /* Configuration information. */ + +#ifndef _PATH_HESIOD_CONF /* Configuration file. */ +#define _PATH_HESIOD_CONF "/etc/hesiod.conf" +#endif + +#define DEF_RHS "" /* Defaults if HESIOD_CONF */ +#define DEF_LHS "" /* file is not present. */ + + /* Error codes (for backwards compatibility) */ + +#define HES_ER_UNINIT -1 /* uninitialized */ +#define HES_ER_OK 0 /* no error */ +#define HES_ER_NOTFOUND 1 /* Hesiod name not found by server */ +#define HES_ER_CONFIG 2 /* local problem (no config file?) */ +#define HES_ER_NET 3 /* network problem */ + + /* Declaration of routines */ + +#include + +__BEGIN_DECLS +int hesiod_init(void **); +char **hesiod_resolve(void *, const char *, const char *); +void hesiod_free_list(void *, char **); +char *hesiod_to_bind(void *, const char *, const char *); +void hesiod_end(void *); + + /* backwards compatibility */ +int hes_init(void); +char *hes_to_bind(const char *, const char *); +char **hes_resolve(const char *, const char *); +int hes_error(void); +void hes_free(char **); +__END_DECLS + +#endif /* ! _HESIOD_H_ */ diff --git a/src/include.new/histedit.h b/src/include.new/histedit.h new file mode 100644 index 0000000..c7415a0 --- /dev/null +++ b/src/include.new/histedit.h @@ -0,0 +1,227 @@ +/*- + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Christos Zoulas of Cornell University. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)histedit.h 8.2 (Berkeley) 1/3/94 + * $NetBSD: histedit.h,v 1.28 2005/07/14 15:00:58 christos Exp $ + * $FreeBSD: src/include/histedit.h,v 1.9.10.1 2005/10/09 03:44:00 delphij Exp $ + */ + +/* + * histedit.h: Line editor and history interface. + */ +#ifndef _HISTEDIT_H_ +#define _HISTEDIT_H_ + +#include +#include + +__BEGIN_DECLS + +/* + * ==== Editing ==== + */ + +typedef struct editline EditLine; + +/* + * For user-defined function interface + */ +typedef struct lineinfo { + const char *buffer; + const char *cursor; + const char *lastchar; +} LineInfo; + +/* + * EditLine editor function return codes. + * For user-defined function interface + */ +#define CC_NORM 0 +#define CC_NEWLINE 1 +#define CC_EOF 2 +#define CC_ARGHACK 3 +#define CC_REFRESH 4 +#define CC_CURSOR 5 +#define CC_ERROR 6 +#define CC_FATAL 7 +#define CC_REDISPLAY 8 +#define CC_REFRESH_BEEP 9 + +/* + * Initialization, cleanup, and resetting + */ +EditLine *el_init(const char *, FILE *, FILE *, FILE *); +void el_end(EditLine *); +void el_reset(EditLine *); + +/* + * Get a line, a character or push a string back in the input queue + */ +const char *el_gets(EditLine *, int *); +int el_getc(EditLine *, char *); +void el_push(EditLine *, char *); + +/* + * Beep! + */ +void el_beep(EditLine *); + +/* + * High level function internals control + * Parses argc, argv array and executes builtin editline commands + */ +int el_parse(EditLine *, int, const char **); + +/* + * Low level editline access functions + */ +int el_set(EditLine *, int, ...); +int el_get(EditLine *, int, void *); +#if 0 +unsigned char _el_fn_complete(EditLine *, int); +#endif + +/* + * el_set/el_get parameters + */ +#define EL_PROMPT 0 /* , el_pfunc_t); */ +#define EL_TERMINAL 1 /* , const char *); */ +#define EL_EDITOR 2 /* , const char *); */ +#define EL_SIGNAL 3 /* , int); */ +#define EL_BIND 4 /* , const char *, ..., NULL); */ +#define EL_TELLTC 5 /* , const char *, ..., NULL); */ +#define EL_SETTC 6 /* , const char *, ..., NULL); */ +#define EL_ECHOTC 7 /* , const char *, ..., NULL); */ +#define EL_SETTY 8 /* , const char *, ..., NULL); */ +#define EL_ADDFN 9 /* , const char *, const char * */ + /* , el_func_t); */ +#define EL_HIST 10 /* , hist_fun_t, const char *); */ +#define EL_EDITMODE 11 /* , int); */ +#define EL_RPROMPT 12 /* , el_pfunc_t); */ +#define EL_GETCFN 13 /* , el_rfunc_t); */ +#define EL_CLIENTDATA 14 /* , void *); */ +#define EL_UNBUFFERED 15 /* , int); */ +#define EL_PREP_TERM 16 /* , int); */ + +#define EL_BUILTIN_GETCFN (NULL) + +/* + * Source named file or $PWD/.editrc or $HOME/.editrc + */ +int el_source(EditLine *, const char *); + +/* + * Must be called when the terminal changes size; If EL_SIGNAL + * is set this is done automatically otherwise it is the responsibility + * of the application + */ +void el_resize(EditLine *); + + +/* + * Set user private data. + */ +void el_data_set __P((EditLine *, void *)); +void * el_data_get __P((EditLine *)); + +/* + * User-defined function interface. + */ +const LineInfo *el_line(EditLine *); +int el_insertstr(EditLine *, const char *); +void el_deletestr(EditLine *, int); + + +/* + * ==== History ==== + */ + +typedef struct history History; + +typedef struct HistEvent { + int num; + const char *str; +} HistEvent; + +/* + * History access functions. + */ +History * history_init(void); +void history_end(History *); + +int history(History *, HistEvent *, int, ...); + +#define H_FUNC 0 /* , UTSL */ +#define H_SETSIZE 1 /* , const int); */ +#define H_EVENT 1 /* , const int); */ +#define H_GETSIZE 2 /* , void); */ +#define H_FIRST 3 /* , void); */ +#define H_LAST 4 /* , void); */ +#define H_PREV 5 /* , void); */ +#define H_NEXT 6 /* , void); */ +#define H_CURR 8 /* , const int); */ +#define H_SET 7 /* , int); */ +#define H_ADD 9 /* , const char *); */ +#define H_ENTER 10 /* , const char *); */ +#define H_APPEND 11 /* , const char *); */ +#define H_END 12 /* , void); */ +#define H_NEXT_STR 13 /* , const char *); */ +#define H_PREV_STR 14 /* , const char *); */ +#define H_NEXT_EVENT 15 /* , const int); */ +#define H_PREV_EVENT 16 /* , const int); */ +#define H_LOAD 17 /* , const char *); */ +#define H_SAVE 18 /* , const char *); */ +#define H_CLEAR 19 /* , void); */ +#define H_SETUNIQUE 20 /* , int); */ +#define H_GETUNIQUE 21 /* , void); */ +#define H_DEL 22 /* , int); */ + + +/* + * ==== Tokenization ==== + */ + +typedef struct tokenizer Tokenizer; + +/* + * String tokenization functions, using simplified sh(1) quoting rules + */ +Tokenizer *tok_init(const char *); +void tok_end(Tokenizer *); +void tok_reset(Tokenizer *); +int tok_line(Tokenizer *, const LineInfo *, + int *, const char ***, int *, int *); +int tok_str(Tokenizer *, const char *, + int *, const char ***); + +__END_DECLS + +#endif /* _HISTEDIT_H_ */ diff --git a/src/include.new/ieeefp.h b/src/include.new/ieeefp.h new file mode 100644 index 0000000..981deea --- /dev/null +++ b/src/include.new/ieeefp.h @@ -0,0 +1,26 @@ +/* $NetBSD: ieeefp.h,v 1.4 1998/01/09 08:03:43 perry Exp $ */ +/* $FreeBSD: src/include/ieeefp.h,v 1.7 2003/01/19 06:01:32 marcel Exp $ */ + +/* + * Written by J.T. Conklin, Apr 6, 1995 + * Public domain. + */ + +#ifndef _IEEEFP_H_ +#define _IEEEFP_H_ + +#include +#include + +#if !defined(_IEEEFP_INLINED_) +__BEGIN_DECLS +extern fp_rnd_t fpgetround(void); +extern fp_rnd_t fpsetround(fp_rnd_t); +extern fp_except_t fpgetmask(void); +extern fp_except_t fpsetmask(fp_except_t); +extern fp_except_t fpgetsticky(void); +extern fp_except_t fpsetsticky(fp_except_t); +__END_DECLS +#endif /* !_IEEEFP_INLINED_ */ + +#endif /* _IEEEFP_H_ */ diff --git a/src/include.new/ifaddrs.h b/src/include.new/ifaddrs.h new file mode 100644 index 0000000..4de13c5a --- /dev/null +++ b/src/include.new/ifaddrs.h @@ -0,0 +1,65 @@ +/* $FreeBSD: src/include/ifaddrs.h,v 1.3 2003/11/14 18:53:22 bms Exp $ */ + +/* + * Copyright (c) 1995, 1999 + * Berkeley Software Design, Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * THIS SOFTWARE IS PROVIDED BY Berkeley Software Design, Inc. ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL Berkeley Software Design, Inc. BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * BSDI ifaddrs.h,v 2.5 2000/02/23 14:51:59 dab Exp + */ + +#ifndef _IFADDRS_H_ +#define _IFADDRS_H_ + +struct ifaddrs { + struct ifaddrs *ifa_next; + char *ifa_name; + u_int ifa_flags; + struct sockaddr *ifa_addr; + struct sockaddr *ifa_netmask; + struct sockaddr *ifa_dstaddr; + void *ifa_data; +}; + +/* + * This may have been defined in . Note that if is + * to be included it must be included before this header file. + */ +#ifndef ifa_broadaddr +#define ifa_broadaddr ifa_dstaddr /* broadcast address interface */ +#endif + +struct ifmaddrs { + struct ifmaddrs *ifma_next; + struct sockaddr *ifma_name; + struct sockaddr *ifma_addr; + struct sockaddr *ifma_lladdr; +}; + +#include + +__BEGIN_DECLS +extern int getifaddrs(struct ifaddrs **); +extern void freeifaddrs(struct ifaddrs *); +extern int getifmaddrs(struct ifmaddrs **); +extern void freeifmaddrs(struct ifmaddrs *); +__END_DECLS + +#endif diff --git a/src/include.new/inttypes.h b/src/include.new/inttypes.h new file mode 100644 index 0000000..ae537a5 --- /dev/null +++ b/src/include.new/inttypes.h @@ -0,0 +1,52 @@ +/*- + * Copyright (c) 2001 Mike Barcroft + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD: src/include/inttypes.h,v 1.8 2002/09/22 08:06:45 tjr Exp $ + */ + +#ifndef _INTTYPES_H_ +#define _INTTYPES_H_ + +#include +#include + +typedef struct { + intmax_t quot; /* Quotient. */ + intmax_t rem; /* Remainder. */ +} imaxdiv_t; + +__BEGIN_DECLS +intmax_t imaxabs(intmax_t) __pure2; +imaxdiv_t imaxdiv(intmax_t, intmax_t) __pure2; + +intmax_t strtoimax(const char * __restrict, char ** __restrict, int); +uintmax_t strtoumax(const char * __restrict, char ** __restrict, int); +intmax_t wcstoimax(const __wchar_t * __restrict, + __wchar_t ** __restrict, int); +uintmax_t wcstoumax(const __wchar_t * __restrict, + __wchar_t ** __restrict, int); +__END_DECLS + +#endif /* !_INTTYPES_H_ */ diff --git a/src/include.new/iso646.h b/src/include.new/iso646.h new file mode 100644 index 0000000..392b19f --- /dev/null +++ b/src/include.new/iso646.h @@ -0,0 +1,44 @@ +/*- + * Copyright (c) 1998 Alex Nash + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD: src/include/iso646.h,v 1.4 2002/09/18 22:23:59 mike Exp $ + */ + +#ifndef _ISO646_H_ +#define _ISO646_H_ + +#define and && +#define and_eq &= +#define bitand & +#define bitor | +#define compl ~ +#define not ! +#define not_eq != +#define or || +#define or_eq |= +#define xor ^ +#define xor_eq ^= + +#endif /* !_ISO646_H_ */ diff --git a/src/include.new/k524_err.h b/src/include.new/k524_err.h new file mode 100644 index 0000000..c46ad67 --- /dev/null +++ b/src/include.new/k524_err.h @@ -0,0 +1,27 @@ +/* Generated from /usr/src/kerberos5/lib/libkrb5/../../../crypto/heimdal/lib/krb5/k524_err.et */ +/* $Id$ */ + +#ifndef __k524_err_h__ +#define __k524_err_h__ + +struct et_list; + +void initialize_k524_error_table_r(struct et_list **); + +void initialize_k524_error_table(void); +#define init_k524_err_tbl initialize_k524_error_table + +typedef enum k524_error_number{ + KRB524_BADKEY = -1750206208, + KRB524_BADADDR = -1750206207, + KRB524_BADPRINC = -1750206206, + KRB524_BADREALM = -1750206205, + KRB524_V4ERR = -1750206204, + KRB524_ENCFULL = -1750206203, + KRB524_DECEMPTY = -1750206202, + KRB524_NOTRESP = -1750206201 +} k524_error_number; + +#define ERROR_TABLE_BASE_k524 -1750206208 + +#endif /* __k524_err_h__ */ diff --git a/src/include.new/kafs.h b/src/include.new/kafs.h new file mode 100644 index 0000000..b475a1b --- /dev/null +++ b/src/include.new/kafs.h @@ -0,0 +1,208 @@ +/* + * Copyright (c) 1995 - 2001, 2003 Kungliga Tekniska H�gskolan + * (Royal Institute of Technology, Stockholm, Sweden). + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of the Institute nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* $Id$ */ + +#ifndef __KAFS_H +#define __KAFS_H + +/* XXX must include krb5.h or krb.h */ + +/* sys/ioctl.h must be included manually before kafs.h */ + +/* + */ +#define AFSCALL_PIOCTL 20 +#define AFSCALL_SETPAG 21 + +#ifndef _VICEIOCTL +#define _VICEIOCTL(id) ((unsigned int ) _IOW('V', id, struct ViceIoctl)) +#endif /* _VICEIOCTL */ + +#define VIOCSETAL _VICEIOCTL(1) +#define VIOCGETAL _VICEIOCTL(2) +#define VIOCSETTOK _VICEIOCTL(3) +#define VIOCGETVOLSTAT _VICEIOCTL(4) +#define VIOCSETVOLSTAT _VICEIOCTL(5) +#define VIOCFLUSH _VICEIOCTL(6) +#define VIOCGETTOK _VICEIOCTL(8) +#define VIOCUNLOG _VICEIOCTL(9) +#define VIOCCKSERV _VICEIOCTL(10) +#define VIOCCKBACK _VICEIOCTL(11) +#define VIOCCKCONN _VICEIOCTL(12) +#define VIOCWHEREIS _VICEIOCTL(14) +#define VIOCACCESS _VICEIOCTL(20) +#define VIOCUNPAG _VICEIOCTL(21) +#define VIOCGETFID _VICEIOCTL(22) +#define VIOCSETCACHESIZE _VICEIOCTL(24) +#define VIOCFLUSHCB _VICEIOCTL(25) +#define VIOCNEWCELL _VICEIOCTL(26) +#define VIOCGETCELL _VICEIOCTL(27) +#define VIOC_AFS_DELETE_MT_PT _VICEIOCTL(28) +#define VIOC_AFS_STAT_MT_PT _VICEIOCTL(29) +#define VIOC_FILE_CELL_NAME _VICEIOCTL(30) +#define VIOC_GET_WS_CELL _VICEIOCTL(31) +#define VIOC_AFS_MARINER_HOST _VICEIOCTL(32) +#define VIOC_GET_PRIMARY_CELL _VICEIOCTL(33) +#define VIOC_VENUSLOG _VICEIOCTL(34) +#define VIOC_GETCELLSTATUS _VICEIOCTL(35) +#define VIOC_SETCELLSTATUS _VICEIOCTL(36) +#define VIOC_FLUSHVOLUME _VICEIOCTL(37) +#define VIOC_AFS_SYSNAME _VICEIOCTL(38) +#define VIOC_EXPORTAFS _VICEIOCTL(39) +#define VIOCGETCACHEPARAMS _VICEIOCTL(40) +#define VIOC_GCPAGS _VICEIOCTL(48) + +struct ViceIoctl { + caddr_t in, out; + short in_size; + short out_size; +}; + +struct ClearToken { + int32_t AuthHandle; + char HandShakeKey[8]; + int32_t ViceId; + int32_t BeginTimestamp; + int32_t EndTimestamp; +}; + +#ifdef __STDC__ +#ifndef __P +#define __P(x) x +#endif +#else +#ifndef __P +#define __P(x) () +#endif +#endif + +/* Use k_hasafs() to probe if the machine supports AFS syscalls. + The other functions will generate a SIGSYS if AFS is not supported */ + +int k_hasafs __P((void)); + +int krb_afslog __P((const char *cell, const char *realm)); +int krb_afslog_uid __P((const char *cell, const char *realm, uid_t uid)); +int krb_afslog_home __P((const char *cell, const char *realm, + const char *homedir)); +int krb_afslog_uid_home __P((const char *cell, const char *realm, uid_t uid, + const char *homedir)); + +int krb_realm_of_cell __P((const char *cell, char **realm)); + +/* compat */ +#define k_afsklog krb_afslog +#define k_afsklog_uid krb_afslog_uid + +int k_pioctl __P((char *a_path, + int o_opcode, + struct ViceIoctl *a_paramsP, + int a_followSymlinks)); +int k_unlog __P((void)); +int k_setpag __P((void)); +int k_afs_cell_of_file __P((const char *path, char *cell, int len)); + + + +/* XXX */ +#ifdef KFAILURE +#define KRB_H_INCLUDED +#endif + +#ifdef KRB5_RECVAUTH_IGNORE_VERSION +#define KRB5_H_INCLUDED +#endif + +void kafs_set_verbose __P((void (*kafs_verbose)(void *, const char *), void *)); +int kafs_settoken_rxkad __P((const char *, struct ClearToken *, + void *ticket, size_t ticket_len)); +#ifdef KRB_H_INCLUDED +int kafs_settoken __P((const char*, uid_t, CREDENTIALS*)); +#endif +#ifdef KRB5_H_INCLUDED +int kafs_settoken5 __P((krb5_context, const char*, uid_t, krb5_creds*)); +#endif + + +#ifdef KRB5_H_INCLUDED +krb5_error_code krb5_afslog_uid __P((krb5_context context, + krb5_ccache id, + const char *cell, + krb5_const_realm realm, + uid_t uid)); +krb5_error_code krb5_afslog __P((krb5_context context, + krb5_ccache id, + const char *cell, + krb5_const_realm realm)); +krb5_error_code krb5_afslog_uid_home __P((krb5_context context, + krb5_ccache id, + const char *cell, + krb5_const_realm realm, + uid_t uid, + const char *homedir)); + +krb5_error_code krb5_afslog_home __P((krb5_context context, + krb5_ccache id, + const char *cell, + krb5_const_realm realm, + const char *homedir)); + +krb5_error_code krb5_realm_of_cell __P((const char *cell, char **realm)); + +#endif + + +#define _PATH_VICE "/usr/vice/etc/" +#define _PATH_THISCELL _PATH_VICE "ThisCell" +#define _PATH_CELLSERVDB _PATH_VICE "CellServDB" +#define _PATH_THESECELLS _PATH_VICE "TheseCells" + +#define _PATH_ARLA_VICE "/usr/arla/etc/" +#define _PATH_ARLA_THISCELL _PATH_ARLA_VICE "ThisCell" +#define _PATH_ARLA_CELLSERVDB _PATH_ARLA_VICE "CellServDB" +#define _PATH_ARLA_THESECELLS _PATH_ARLA_VICE "TheseCells" + +#define _PATH_OPENAFS_DEBIAN_VICE "/etc/openafs/" +#define _PATH_OPENAFS_DEBIAN_THISCELL _PATH_OPENAFS_DEBIAN_VICE "ThisCell" +#define _PATH_OPENAFS_DEBIAN_CELLSERVDB _PATH_OPENAFS_DEBIAN_VICE "CellServDB" +#define _PATH_OPENAFS_DEBIAN_THESECELLS _PATH_OPENAFS_DEBIAN_VICE "TheseCells" + +#define _PATH_ARLA_DEBIAN_VICE "/etc/arla/" +#define _PATH_ARLA_DEBIAN_THISCELL _PATH_ARLA_DEBIAN_VICE "ThisCell" +#define _PATH_ARLA_DEBIAN_CELLSERVDB _PATH_ARLA_DEBIAN_VICE "CellServDB" +#define _PATH_ARLA_DEBIAN_THESECELLS _PATH_ARLA_DEBIAN_VICE "TheseCells" + +extern int _kafs_debug; + +#endif /* __KAFS_H */ diff --git a/src/include.new/kenv.h b/src/include.new/kenv.h new file mode 100644 index 0000000..e41bb59 --- /dev/null +++ b/src/include.new/kenv.h @@ -0,0 +1,39 @@ +/*- + * Copyright (c) 2002 Maxime Henrion + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD: src/include/kenv.h,v 1.1 2002/04/17 13:06:32 mux Exp $ + */ + +#ifndef _KENV_H_ +#define _KENV_H_ + +#include +#include + +__BEGIN_DECLS +int kenv(int, char *, char *, int); +__END_DECLS + +#endif /* !_KENV_H_ */ diff --git a/src/include.new/krb5-protos.h b/src/include.new/krb5-protos.h new file mode 100644 index 0000000..58788ae --- /dev/null +++ b/src/include.new/krb5-protos.h @@ -0,0 +1,2986 @@ +/* This is a generated file */ +#ifndef __krb5_protos_h__ +#define __krb5_protos_h__ + +#include + +#if !defined(__GNUC__) && !defined(__attribute__) +#define __attribute__(x) +#endif + +krb5_error_code +krb524_convert_creds_kdc ( + krb5_context /*context*/, + krb5_creds */*in_cred*/, + struct credentials */*v4creds*/); + +krb5_error_code +krb524_convert_creds_kdc_ccache ( + krb5_context /*context*/, + krb5_ccache /*ccache*/, + krb5_creds */*in_cred*/, + struct credentials */*v4creds*/); + +krb5_error_code +krb5_425_conv_principal ( + krb5_context /*context*/, + const char */*name*/, + const char */*instance*/, + const char */*realm*/, + krb5_principal */*princ*/); + +krb5_error_code +krb5_425_conv_principal_ext ( + krb5_context /*context*/, + const char */*name*/, + const char */*instance*/, + const char */*realm*/, + krb5_boolean (*/*func*/)(krb5_context, krb5_principal), + krb5_boolean /*resolve*/, + krb5_principal */*princ*/); + +krb5_error_code +krb5_524_conv_principal ( + krb5_context /*context*/, + const krb5_principal /*principal*/, + char */*name*/, + char */*instance*/, + char */*realm*/); + +krb5_error_code +krb5_PKCS5_PBKDF2 ( + krb5_context /*context*/, + krb5_cksumtype /*cktype*/, + krb5_data /*password*/, + krb5_salt /*salt*/, + u_int32_t /*iter*/, + krb5_keytype /*type*/, + krb5_keyblock */*key*/); + +krb5_error_code +krb5_abort ( + krb5_context /*context*/, + krb5_error_code /*code*/, + const char */*fmt*/, + ...) + __attribute__ ((noreturn, format (printf, 3, 4))); + +krb5_error_code +krb5_abortx ( + krb5_context /*context*/, + const char */*fmt*/, + ...) + __attribute__ ((noreturn, format (printf, 2, 3))); + +krb5_error_code +krb5_acl_match_file ( + krb5_context /*context*/, + const char */*file*/, + const char */*format*/, + ...); + +krb5_error_code +krb5_acl_match_string ( + krb5_context /*context*/, + const char */*string*/, + const char */*format*/, + ...); + +krb5_error_code +krb5_add_et_list ( + krb5_context /*context*/, + void (*/*func*/)(struct et_list **)); + +krb5_error_code +krb5_add_extra_addresses ( + krb5_context /*context*/, + krb5_addresses */*addresses*/); + +krb5_error_code +krb5_add_ignore_addresses ( + krb5_context /*context*/, + krb5_addresses */*addresses*/); + +krb5_error_code +krb5_addlog_dest ( + krb5_context /*context*/, + krb5_log_facility */*f*/, + const char */*orig*/); + +krb5_error_code +krb5_addlog_func ( + krb5_context /*context*/, + krb5_log_facility */*fac*/, + int /*min*/, + int /*max*/, + krb5_log_log_func_t /*log*/, + krb5_log_close_func_t /*close*/, + void */*data*/); + +krb5_error_code +krb5_addr2sockaddr ( + krb5_context /*context*/, + const krb5_address */*addr*/, + struct sockaddr */*sa*/, + krb5_socklen_t */*sa_size*/, + int /*port*/); + +krb5_boolean +krb5_address_compare ( + krb5_context /*context*/, + const krb5_address */*addr1*/, + const krb5_address */*addr2*/); + +int +krb5_address_order ( + krb5_context /*context*/, + const krb5_address */*addr1*/, + const krb5_address */*addr2*/); + +krb5_boolean +krb5_address_search ( + krb5_context /*context*/, + const krb5_address */*addr*/, + const krb5_addresses */*addrlist*/); + +krb5_error_code +krb5_aname_to_localname ( + krb5_context /*context*/, + krb5_const_principal /*aname*/, + size_t /*lnsize*/, + char */*lname*/); + +krb5_error_code +krb5_anyaddr ( + krb5_context /*context*/, + int /*af*/, + struct sockaddr */*sa*/, + krb5_socklen_t */*sa_size*/, + int /*port*/); + +void +krb5_appdefault_boolean ( + krb5_context /*context*/, + const char */*appname*/, + krb5_const_realm /*realm*/, + const char */*option*/, + krb5_boolean /*def_val*/, + krb5_boolean */*ret_val*/); + +void +krb5_appdefault_string ( + krb5_context /*context*/, + const char */*appname*/, + krb5_const_realm /*realm*/, + const char */*option*/, + const char */*def_val*/, + char **/*ret_val*/); + +void +krb5_appdefault_time ( + krb5_context /*context*/, + const char */*appname*/, + krb5_const_realm /*realm*/, + const char */*option*/, + time_t /*def_val*/, + time_t */*ret_val*/); + +krb5_error_code +krb5_append_addresses ( + krb5_context /*context*/, + krb5_addresses */*dest*/, + const krb5_addresses */*source*/); + +krb5_error_code +krb5_auth_con_free ( + krb5_context /*context*/, + krb5_auth_context /*auth_context*/); + +krb5_error_code +krb5_auth_con_genaddrs ( + krb5_context /*context*/, + krb5_auth_context /*auth_context*/, + int /*fd*/, + int /*flags*/); + +krb5_error_code +krb5_auth_con_generatelocalsubkey ( + krb5_context /*context*/, + krb5_auth_context /*auth_context*/, + krb5_keyblock */*key*/); + +krb5_error_code +krb5_auth_con_getaddrs ( + krb5_context /*context*/, + krb5_auth_context /*auth_context*/, + krb5_address **/*local_addr*/, + krb5_address **/*remote_addr*/); + +krb5_error_code +krb5_auth_con_getauthenticator ( + krb5_context /*context*/, + krb5_auth_context /*auth_context*/, + krb5_authenticator */*authenticator*/); + +krb5_error_code +krb5_auth_con_getcksumtype ( + krb5_context /*context*/, + krb5_auth_context /*auth_context*/, + krb5_cksumtype */*cksumtype*/); + +krb5_error_code +krb5_auth_con_getflags ( + krb5_context /*context*/, + krb5_auth_context /*auth_context*/, + int32_t */*flags*/); + +krb5_error_code +krb5_auth_con_getkey ( + krb5_context /*context*/, + krb5_auth_context /*auth_context*/, + krb5_keyblock **/*keyblock*/); + +krb5_error_code +krb5_auth_con_getkeytype ( + krb5_context /*context*/, + krb5_auth_context /*auth_context*/, + krb5_keytype */*keytype*/); + +krb5_error_code +krb5_auth_con_getlocalseqnumber ( + krb5_context /*context*/, + krb5_auth_context /*auth_context*/, + int32_t */*seqnumber*/); + +krb5_error_code +krb5_auth_con_getlocalsubkey ( + krb5_context /*context*/, + krb5_auth_context /*auth_context*/, + krb5_keyblock **/*keyblock*/); + +krb5_error_code +krb5_auth_con_getrcache ( + krb5_context /*context*/, + krb5_auth_context /*auth_context*/, + krb5_rcache */*rcache*/); + +krb5_error_code +krb5_auth_con_getremotesubkey ( + krb5_context /*context*/, + krb5_auth_context /*auth_context*/, + krb5_keyblock **/*keyblock*/); + +krb5_error_code +krb5_auth_con_init ( + krb5_context /*context*/, + krb5_auth_context */*auth_context*/); + +krb5_error_code +krb5_auth_con_setaddrs ( + krb5_context /*context*/, + krb5_auth_context /*auth_context*/, + krb5_address */*local_addr*/, + krb5_address */*remote_addr*/); + +krb5_error_code +krb5_auth_con_setaddrs_from_fd ( + krb5_context /*context*/, + krb5_auth_context /*auth_context*/, + void */*p_fd*/); + +krb5_error_code +krb5_auth_con_setcksumtype ( + krb5_context /*context*/, + krb5_auth_context /*auth_context*/, + krb5_cksumtype /*cksumtype*/); + +krb5_error_code +krb5_auth_con_setflags ( + krb5_context /*context*/, + krb5_auth_context /*auth_context*/, + int32_t /*flags*/); + +krb5_error_code +krb5_auth_con_setkey ( + krb5_context /*context*/, + krb5_auth_context /*auth_context*/, + krb5_keyblock */*keyblock*/); + +krb5_error_code +krb5_auth_con_setkeytype ( + krb5_context /*context*/, + krb5_auth_context /*auth_context*/, + krb5_keytype /*keytype*/); + +krb5_error_code +krb5_auth_con_setlocalseqnumber ( + krb5_context /*context*/, + krb5_auth_context /*auth_context*/, + int32_t /*seqnumber*/); + +krb5_error_code +krb5_auth_con_setlocalsubkey ( + krb5_context /*context*/, + krb5_auth_context /*auth_context*/, + krb5_keyblock */*keyblock*/); + +krb5_error_code +krb5_auth_con_setrcache ( + krb5_context /*context*/, + krb5_auth_context /*auth_context*/, + krb5_rcache /*rcache*/); + +krb5_error_code +krb5_auth_con_setremoteseqnumber ( + krb5_context /*context*/, + krb5_auth_context /*auth_context*/, + int32_t /*seqnumber*/); + +krb5_error_code +krb5_auth_con_setremotesubkey ( + krb5_context /*context*/, + krb5_auth_context /*auth_context*/, + krb5_keyblock */*keyblock*/); + +krb5_error_code +krb5_auth_con_setuserkey ( + krb5_context /*context*/, + krb5_auth_context /*auth_context*/, + krb5_keyblock */*keyblock*/); + +krb5_error_code +krb5_auth_getremoteseqnumber ( + krb5_context /*context*/, + krb5_auth_context /*auth_context*/, + int32_t */*seqnumber*/); + +krb5_error_code +krb5_build_ap_req ( + krb5_context /*context*/, + krb5_enctype /*enctype*/, + krb5_creds */*cred*/, + krb5_flags /*ap_options*/, + krb5_data /*authenticator*/, + krb5_data */*retdata*/); + +krb5_error_code +krb5_build_authenticator ( + krb5_context /*context*/, + krb5_auth_context /*auth_context*/, + krb5_enctype /*enctype*/, + krb5_creds */*cred*/, + Checksum */*cksum*/, + Authenticator **/*auth_result*/, + krb5_data */*result*/, + krb5_key_usage /*usage*/); + +krb5_error_code +krb5_build_principal ( + krb5_context /*context*/, + krb5_principal */*principal*/, + int /*rlen*/, + krb5_const_realm /*realm*/, + ...); + +krb5_error_code +krb5_build_principal_ext ( + krb5_context /*context*/, + krb5_principal */*principal*/, + int /*rlen*/, + krb5_const_realm /*realm*/, + ...); + +krb5_error_code +krb5_build_principal_va ( + krb5_context /*context*/, + krb5_principal */*principal*/, + int /*rlen*/, + krb5_const_realm /*realm*/, + va_list /*ap*/); + +krb5_error_code +krb5_build_principal_va_ext ( + krb5_context /*context*/, + krb5_principal */*principal*/, + int /*rlen*/, + krb5_const_realm /*realm*/, + va_list /*ap*/); + +krb5_error_code +krb5_cc_close ( + krb5_context /*context*/, + krb5_ccache /*id*/); + +krb5_error_code +krb5_cc_copy_cache ( + krb5_context /*context*/, + const krb5_ccache /*from*/, + krb5_ccache /*to*/); + +krb5_error_code +krb5_cc_default ( + krb5_context /*context*/, + krb5_ccache */*id*/); + +const char* +krb5_cc_default_name (krb5_context /*context*/); + +krb5_error_code +krb5_cc_destroy ( + krb5_context /*context*/, + krb5_ccache /*id*/); + +krb5_error_code +krb5_cc_end_seq_get ( + krb5_context /*context*/, + const krb5_ccache /*id*/, + krb5_cc_cursor */*cursor*/); + +krb5_error_code +krb5_cc_gen_new ( + krb5_context /*context*/, + const krb5_cc_ops */*ops*/, + krb5_ccache */*id*/); + +const char* +krb5_cc_get_name ( + krb5_context /*context*/, + krb5_ccache /*id*/); + +const krb5_cc_ops * +krb5_cc_get_ops ( + krb5_context /*context*/, + krb5_ccache /*id*/); + +krb5_error_code +krb5_cc_get_principal ( + krb5_context /*context*/, + krb5_ccache /*id*/, + krb5_principal */*principal*/); + +const char* +krb5_cc_get_type ( + krb5_context /*context*/, + krb5_ccache /*id*/); + +krb5_error_code +krb5_cc_get_version ( + krb5_context /*context*/, + const krb5_ccache /*id*/); + +krb5_error_code +krb5_cc_initialize ( + krb5_context /*context*/, + krb5_ccache /*id*/, + krb5_principal /*primary_principal*/); + +krb5_error_code +krb5_cc_next_cred ( + krb5_context /*context*/, + const krb5_ccache /*id*/, + krb5_cc_cursor */*cursor*/, + krb5_creds */*creds*/); + +krb5_error_code +krb5_cc_register ( + krb5_context /*context*/, + const krb5_cc_ops */*ops*/, + krb5_boolean /*override*/); + +krb5_error_code +krb5_cc_remove_cred ( + krb5_context /*context*/, + krb5_ccache /*id*/, + krb5_flags /*which*/, + krb5_creds */*cred*/); + +krb5_error_code +krb5_cc_resolve ( + krb5_context /*context*/, + const char */*name*/, + krb5_ccache */*id*/); + +krb5_error_code +krb5_cc_retrieve_cred ( + krb5_context /*context*/, + krb5_ccache /*id*/, + krb5_flags /*whichfields*/, + const krb5_creds */*mcreds*/, + krb5_creds */*creds*/); + +krb5_error_code +krb5_cc_set_default_name ( + krb5_context /*context*/, + const char */*name*/); + +krb5_error_code +krb5_cc_set_flags ( + krb5_context /*context*/, + krb5_ccache /*id*/, + krb5_flags /*flags*/); + +krb5_error_code +krb5_cc_start_seq_get ( + krb5_context /*context*/, + const krb5_ccache /*id*/, + krb5_cc_cursor */*cursor*/); + +krb5_error_code +krb5_cc_store_cred ( + krb5_context /*context*/, + krb5_ccache /*id*/, + krb5_creds */*creds*/); + +krb5_error_code +krb5_change_password ( + krb5_context /*context*/, + krb5_creds */*creds*/, + char */*newpw*/, + int */*result_code*/, + krb5_data */*result_code_string*/, + krb5_data */*result_string*/); + +krb5_error_code +krb5_check_transited ( + krb5_context /*context*/, + krb5_const_realm /*client_realm*/, + krb5_const_realm /*server_realm*/, + krb5_realm */*realms*/, + int /*num_realms*/, + int */*bad_realm*/); + +krb5_error_code +krb5_check_transited_realms ( + krb5_context /*context*/, + const char *const */*realms*/, + int /*num_realms*/, + int */*bad_realm*/); + +krb5_boolean +krb5_checksum_is_collision_proof ( + krb5_context /*context*/, + krb5_cksumtype /*type*/); + +krb5_boolean +krb5_checksum_is_keyed ( + krb5_context /*context*/, + krb5_cksumtype /*type*/); + +krb5_error_code +krb5_checksumsize ( + krb5_context /*context*/, + krb5_cksumtype /*type*/, + size_t */*size*/); + +void +krb5_clear_error_string (krb5_context /*context*/); + +krb5_error_code +krb5_closelog ( + krb5_context /*context*/, + krb5_log_facility */*fac*/); + +krb5_boolean +krb5_compare_creds ( + krb5_context /*context*/, + krb5_flags /*whichfields*/, + const krb5_creds */*mcreds*/, + const krb5_creds */*creds*/); + +krb5_error_code +krb5_config_file_free ( + krb5_context /*context*/, + krb5_config_section */*s*/); + +void +krb5_config_free_strings (char **/*strings*/); + +const void * +krb5_config_get ( + krb5_context /*context*/, + const krb5_config_section */*c*/, + int /*type*/, + ...); + +krb5_boolean +krb5_config_get_bool ( + krb5_context /*context*/, + const krb5_config_section */*c*/, + ...); + +krb5_boolean +krb5_config_get_bool_default ( + krb5_context /*context*/, + const krb5_config_section */*c*/, + krb5_boolean /*def_value*/, + ...); + +int +krb5_config_get_int ( + krb5_context /*context*/, + const krb5_config_section */*c*/, + ...); + +int +krb5_config_get_int_default ( + krb5_context /*context*/, + const krb5_config_section */*c*/, + int /*def_value*/, + ...); + +const krb5_config_binding * +krb5_config_get_list ( + krb5_context /*context*/, + const krb5_config_section */*c*/, + ...); + +const void * +krb5_config_get_next ( + krb5_context /*context*/, + const krb5_config_section */*c*/, + const krb5_config_binding **/*pointer*/, + int /*type*/, + ...); + +const char * +krb5_config_get_string ( + krb5_context /*context*/, + const krb5_config_section */*c*/, + ...); + +const char * +krb5_config_get_string_default ( + krb5_context /*context*/, + const krb5_config_section */*c*/, + const char */*def_value*/, + ...); + +char** +krb5_config_get_strings ( + krb5_context /*context*/, + const krb5_config_section */*c*/, + ...); + +int +krb5_config_get_time ( + krb5_context /*context*/, + const krb5_config_section */*c*/, + ...); + +int +krb5_config_get_time_default ( + krb5_context /*context*/, + const krb5_config_section */*c*/, + int /*def_value*/, + ...); + +krb5_error_code +krb5_config_parse_file ( + krb5_context /*context*/, + const char */*fname*/, + krb5_config_section **/*res*/); + +krb5_error_code +krb5_config_parse_file_multi ( + krb5_context /*context*/, + const char */*fname*/, + krb5_config_section **/*res*/); + +const void * +krb5_config_vget ( + krb5_context /*context*/, + const krb5_config_section */*c*/, + int /*type*/, + va_list /*args*/); + +krb5_boolean +krb5_config_vget_bool ( + krb5_context /*context*/, + const krb5_config_section */*c*/, + va_list /*args*/); + +krb5_boolean +krb5_config_vget_bool_default ( + krb5_context /*context*/, + const krb5_config_section */*c*/, + krb5_boolean /*def_value*/, + va_list /*args*/); + +int +krb5_config_vget_int ( + krb5_context /*context*/, + const krb5_config_section */*c*/, + va_list /*args*/); + +int +krb5_config_vget_int_default ( + krb5_context /*context*/, + const krb5_config_section */*c*/, + int /*def_value*/, + va_list /*args*/); + +const krb5_config_binding * +krb5_config_vget_list ( + krb5_context /*context*/, + const krb5_config_section */*c*/, + va_list /*args*/); + +const void * +krb5_config_vget_next ( + krb5_context /*context*/, + const krb5_config_section */*c*/, + const krb5_config_binding **/*pointer*/, + int /*type*/, + va_list /*args*/); + +const char * +krb5_config_vget_string ( + krb5_context /*context*/, + const krb5_config_section */*c*/, + va_list /*args*/); + +const char * +krb5_config_vget_string_default ( + krb5_context /*context*/, + const krb5_config_section */*c*/, + const char */*def_value*/, + va_list /*args*/); + +char ** +krb5_config_vget_strings ( + krb5_context /*context*/, + const krb5_config_section */*c*/, + va_list /*args*/); + +int +krb5_config_vget_time ( + krb5_context /*context*/, + const krb5_config_section */*c*/, + va_list /*args*/); + +int +krb5_config_vget_time_default ( + krb5_context /*context*/, + const krb5_config_section */*c*/, + int /*def_value*/, + va_list /*args*/); + +krb5_error_code +krb5_copy_address ( + krb5_context /*context*/, + const krb5_address */*inaddr*/, + krb5_address */*outaddr*/); + +krb5_error_code +krb5_copy_addresses ( + krb5_context /*context*/, + const krb5_addresses */*inaddr*/, + krb5_addresses */*outaddr*/); + +krb5_error_code +krb5_copy_creds ( + krb5_context /*context*/, + const krb5_creds */*incred*/, + krb5_creds **/*outcred*/); + +krb5_error_code +krb5_copy_creds_contents ( + krb5_context /*context*/, + const krb5_creds */*incred*/, + krb5_creds */*c*/); + +krb5_error_code +krb5_copy_data ( + krb5_context /*context*/, + const krb5_data */*indata*/, + krb5_data **/*outdata*/); + +krb5_error_code +krb5_copy_host_realm ( + krb5_context /*context*/, + const krb5_realm */*from*/, + krb5_realm **/*to*/); + +krb5_error_code +krb5_copy_keyblock ( + krb5_context /*context*/, + const krb5_keyblock */*inblock*/, + krb5_keyblock **/*to*/); + +krb5_error_code +krb5_copy_keyblock_contents ( + krb5_context /*context*/, + const krb5_keyblock */*inblock*/, + krb5_keyblock */*to*/); + +krb5_error_code +krb5_copy_principal ( + krb5_context /*context*/, + krb5_const_principal /*inprinc*/, + krb5_principal */*outprinc*/); + +krb5_error_code +krb5_copy_ticket ( + krb5_context /*context*/, + const krb5_ticket */*from*/, + krb5_ticket **/*to*/); + +krb5_error_code +krb5_create_checksum ( + krb5_context /*context*/, + krb5_crypto /*crypto*/, + krb5_key_usage /*usage*/, + int /*type*/, + void */*data*/, + size_t /*len*/, + Checksum */*result*/); + +krb5_error_code +krb5_crypto_destroy ( + krb5_context /*context*/, + krb5_crypto /*crypto*/); + +krb5_error_code +krb5_crypto_getblocksize ( + krb5_context /*context*/, + krb5_crypto /*crypto*/, + size_t */*blocksize*/); + +krb5_error_code +krb5_crypto_init ( + krb5_context /*context*/, + const krb5_keyblock */*key*/, + krb5_enctype /*etype*/, + krb5_crypto */*crypto*/); + +krb5_error_code +krb5_data_alloc ( + krb5_data */*p*/, + int /*len*/); + +krb5_error_code +krb5_data_copy ( + krb5_data */*p*/, + const void */*data*/, + size_t /*len*/); + +void +krb5_data_free (krb5_data */*p*/); + +krb5_error_code +krb5_data_realloc ( + krb5_data */*p*/, + int /*len*/); + +void +krb5_data_zero (krb5_data */*p*/); + +krb5_error_code +krb5_decode_Authenticator ( + krb5_context /*context*/, + const void */*data*/, + size_t /*length*/, + Authenticator */*t*/, + size_t */*len*/); + +krb5_error_code +krb5_decode_ETYPE_INFO ( + krb5_context /*context*/, + const void */*data*/, + size_t /*length*/, + ETYPE_INFO */*t*/, + size_t */*len*/); + +krb5_error_code +krb5_decode_EncAPRepPart ( + krb5_context /*context*/, + const void */*data*/, + size_t /*length*/, + EncAPRepPart */*t*/, + size_t */*len*/); + +krb5_error_code +krb5_decode_EncASRepPart ( + krb5_context /*context*/, + const void */*data*/, + size_t /*length*/, + EncASRepPart */*t*/, + size_t */*len*/); + +krb5_error_code +krb5_decode_EncKrbCredPart ( + krb5_context /*context*/, + const void */*data*/, + size_t /*length*/, + EncKrbCredPart */*t*/, + size_t */*len*/); + +krb5_error_code +krb5_decode_EncTGSRepPart ( + krb5_context /*context*/, + const void */*data*/, + size_t /*length*/, + EncTGSRepPart */*t*/, + size_t */*len*/); + +krb5_error_code +krb5_decode_EncTicketPart ( + krb5_context /*context*/, + const void */*data*/, + size_t /*length*/, + EncTicketPart */*t*/, + size_t */*len*/); + +krb5_error_code +krb5_decode_ap_req ( + krb5_context /*context*/, + const krb5_data */*inbuf*/, + krb5_ap_req */*ap_req*/); + +krb5_error_code +krb5_decrypt ( + krb5_context /*context*/, + krb5_crypto /*crypto*/, + unsigned /*usage*/, + void */*data*/, + size_t /*len*/, + krb5_data */*result*/); + +krb5_error_code +krb5_decrypt_EncryptedData ( + krb5_context /*context*/, + krb5_crypto /*crypto*/, + unsigned /*usage*/, + const EncryptedData */*e*/, + krb5_data */*result*/); + +krb5_error_code +krb5_decrypt_ivec ( + krb5_context /*context*/, + krb5_crypto /*crypto*/, + unsigned /*usage*/, + void */*data*/, + size_t /*len*/, + krb5_data */*result*/, + void */*ivec*/); + +krb5_error_code +krb5_decrypt_ticket ( + krb5_context /*context*/, + Ticket */*ticket*/, + krb5_keyblock */*key*/, + EncTicketPart */*out*/, + krb5_flags /*flags*/); + +krb5_error_code +krb5_derive_key ( + krb5_context /*context*/, + const krb5_keyblock */*key*/, + krb5_enctype /*etype*/, + const void */*constant*/, + size_t /*constant_len*/, + krb5_keyblock **/*derived_key*/); + +krb5_error_code +krb5_domain_x500_decode ( + krb5_context /*context*/, + krb5_data /*tr*/, + char ***/*realms*/, + int */*num_realms*/, + const char */*client_realm*/, + const char */*server_realm*/); + +krb5_error_code +krb5_domain_x500_encode ( + char **/*realms*/, + int /*num_realms*/, + krb5_data */*encoding*/); + +krb5_error_code +krb5_eai_to_heim_errno ( + int /*eai_errno*/, + int /*system_error*/); + +krb5_error_code +krb5_encode_Authenticator ( + krb5_context /*context*/, + void */*data*/, + size_t /*length*/, + Authenticator */*t*/, + size_t */*len*/); + +krb5_error_code +krb5_encode_ETYPE_INFO ( + krb5_context /*context*/, + void */*data*/, + size_t /*length*/, + ETYPE_INFO */*t*/, + size_t */*len*/); + +krb5_error_code +krb5_encode_EncAPRepPart ( + krb5_context /*context*/, + void */*data*/, + size_t /*length*/, + EncAPRepPart */*t*/, + size_t */*len*/); + +krb5_error_code +krb5_encode_EncASRepPart ( + krb5_context /*context*/, + void */*data*/, + size_t /*length*/, + EncASRepPart */*t*/, + size_t */*len*/); + +krb5_error_code +krb5_encode_EncKrbCredPart ( + krb5_context /*context*/, + void */*data*/, + size_t /*length*/, + EncKrbCredPart */*t*/, + size_t */*len*/); + +krb5_error_code +krb5_encode_EncTGSRepPart ( + krb5_context /*context*/, + void */*data*/, + size_t /*length*/, + EncTGSRepPart */*t*/, + size_t */*len*/); + +krb5_error_code +krb5_encode_EncTicketPart ( + krb5_context /*context*/, + void */*data*/, + size_t /*length*/, + EncTicketPart */*t*/, + size_t */*len*/); + +krb5_error_code +krb5_encrypt ( + krb5_context /*context*/, + krb5_crypto /*crypto*/, + unsigned /*usage*/, + void */*data*/, + size_t /*len*/, + krb5_data */*result*/); + +krb5_error_code +krb5_encrypt_EncryptedData ( + krb5_context /*context*/, + krb5_crypto /*crypto*/, + unsigned /*usage*/, + void */*data*/, + size_t /*len*/, + int /*kvno*/, + EncryptedData */*result*/); + +krb5_error_code +krb5_encrypt_ivec ( + krb5_context /*context*/, + krb5_crypto /*crypto*/, + unsigned /*usage*/, + void */*data*/, + size_t /*len*/, + krb5_data */*result*/, + void */*ivec*/); + +krb5_error_code +krb5_enctype_keysize ( + krb5_context /*context*/, + krb5_enctype /*type*/, + size_t */*keysize*/); + +krb5_error_code +krb5_enctype_to_keytype ( + krb5_context /*context*/, + krb5_enctype /*etype*/, + krb5_keytype */*keytype*/); + +krb5_error_code +krb5_enctype_to_string ( + krb5_context /*context*/, + krb5_enctype /*etype*/, + char **/*string*/); + +krb5_error_code +krb5_enctype_valid ( + krb5_context /*context*/, + krb5_enctype /*etype*/); + +krb5_boolean +krb5_enctypes_compatible_keys ( + krb5_context /*context*/, + krb5_enctype /*etype1*/, + krb5_enctype /*etype2*/); + +krb5_error_code +krb5_err ( + krb5_context /*context*/, + int /*eval*/, + krb5_error_code /*code*/, + const char */*fmt*/, + ...) + __attribute__ ((noreturn, format (printf, 4, 5))); + +krb5_error_code +krb5_error_from_rd_error ( + krb5_context /*context*/, + const krb5_error */*error*/, + const krb5_creds */*creds*/); + +krb5_error_code +krb5_errx ( + krb5_context /*context*/, + int /*eval*/, + const char */*fmt*/, + ...) + __attribute__ ((noreturn, format (printf, 3, 4))); + +krb5_error_code +krb5_expand_hostname ( + krb5_context /*context*/, + const char */*orig_hostname*/, + char **/*new_hostname*/); + +krb5_error_code +krb5_expand_hostname_realms ( + krb5_context /*context*/, + const char */*orig_hostname*/, + char **/*new_hostname*/, + char ***/*realms*/); + +PA_DATA * +krb5_find_padata ( + PA_DATA */*val*/, + unsigned /*len*/, + int /*type*/, + int */*index*/); + +krb5_error_code +krb5_format_time ( + krb5_context /*context*/, + time_t /*t*/, + char */*s*/, + size_t /*len*/, + krb5_boolean /*include_time*/); + +krb5_error_code +krb5_free_address ( + krb5_context /*context*/, + krb5_address */*address*/); + +krb5_error_code +krb5_free_addresses ( + krb5_context /*context*/, + krb5_addresses */*addresses*/); + +void +krb5_free_ap_rep_enc_part ( + krb5_context /*context*/, + krb5_ap_rep_enc_part */*val*/); + +void +krb5_free_authenticator ( + krb5_context /*context*/, + krb5_authenticator */*authenticator*/); + +void +krb5_free_config_files (char **/*filenames*/); + +void +krb5_free_context (krb5_context /*context*/); + +krb5_error_code +krb5_free_cred_contents ( + krb5_context /*context*/, + krb5_creds */*c*/); + +krb5_error_code +krb5_free_creds ( + krb5_context /*context*/, + krb5_creds */*c*/); + +krb5_error_code +krb5_free_creds_contents ( + krb5_context /*context*/, + krb5_creds */*c*/); + +void +krb5_free_data ( + krb5_context /*context*/, + krb5_data */*p*/); + +void +krb5_free_data_contents ( + krb5_context /*context*/, + krb5_data */*data*/); + +void +krb5_free_error ( + krb5_context /*context*/, + krb5_error */*error*/); + +void +krb5_free_error_contents ( + krb5_context /*context*/, + krb5_error */*error*/); + +void +krb5_free_error_string ( + krb5_context /*context*/, + char */*str*/); + +krb5_error_code +krb5_free_host_realm ( + krb5_context /*context*/, + krb5_realm */*realmlist*/); + +krb5_error_code +krb5_free_kdc_rep ( + krb5_context /*context*/, + krb5_kdc_rep */*rep*/); + +void +krb5_free_keyblock ( + krb5_context /*context*/, + krb5_keyblock */*keyblock*/); + +void +krb5_free_keyblock_contents ( + krb5_context /*context*/, + krb5_keyblock */*keyblock*/); + +krb5_error_code +krb5_free_krbhst ( + krb5_context /*context*/, + char **/*hostlist*/); + +void +krb5_free_principal ( + krb5_context /*context*/, + krb5_principal /*p*/); + +krb5_error_code +krb5_free_salt ( + krb5_context /*context*/, + krb5_salt /*salt*/); + +krb5_error_code +krb5_free_ticket ( + krb5_context /*context*/, + krb5_ticket */*ticket*/); + +krb5_error_code +krb5_fwd_tgt_creds ( + krb5_context /*context*/, + krb5_auth_context /*auth_context*/, + const char */*hostname*/, + krb5_principal /*client*/, + krb5_principal /*server*/, + krb5_ccache /*ccache*/, + int /*forwardable*/, + krb5_data */*out_data*/); + +void +krb5_generate_random_block ( + void */*buf*/, + size_t /*len*/); + +krb5_error_code +krb5_generate_random_keyblock ( + krb5_context /*context*/, + krb5_enctype /*type*/, + krb5_keyblock */*key*/); + +krb5_error_code +krb5_generate_seq_number ( + krb5_context /*context*/, + const krb5_keyblock */*key*/, + u_int32_t */*seqno*/); + +krb5_error_code +krb5_generate_subkey ( + krb5_context /*context*/, + const krb5_keyblock */*key*/, + krb5_keyblock **/*subkey*/); + +krb5_error_code +krb5_get_all_client_addrs ( + krb5_context /*context*/, + krb5_addresses */*res*/); + +krb5_error_code +krb5_get_all_server_addrs ( + krb5_context /*context*/, + krb5_addresses */*res*/); + +krb5_error_code +krb5_get_cred_from_kdc ( + krb5_context /*context*/, + krb5_ccache /*ccache*/, + krb5_creds */*in_creds*/, + krb5_creds **/*out_creds*/, + krb5_creds ***/*ret_tgts*/); + +krb5_error_code +krb5_get_cred_from_kdc_opt ( + krb5_context /*context*/, + krb5_ccache /*ccache*/, + krb5_creds */*in_creds*/, + krb5_creds **/*out_creds*/, + krb5_creds ***/*ret_tgts*/, + krb5_flags /*flags*/); + +krb5_error_code +krb5_get_credentials ( + krb5_context /*context*/, + krb5_flags /*options*/, + krb5_ccache /*ccache*/, + krb5_creds */*in_creds*/, + krb5_creds **/*out_creds*/); + +krb5_error_code +krb5_get_credentials_with_flags ( + krb5_context /*context*/, + krb5_flags /*options*/, + krb5_kdc_flags /*flags*/, + krb5_ccache /*ccache*/, + krb5_creds */*in_creds*/, + krb5_creds **/*out_creds*/); + +krb5_error_code +krb5_get_default_config_files (char ***/*pfilenames*/); + +krb5_error_code +krb5_get_default_in_tkt_etypes ( + krb5_context /*context*/, + krb5_enctype **/*etypes*/); + +krb5_error_code +krb5_get_default_principal ( + krb5_context /*context*/, + krb5_principal */*princ*/); + +krb5_error_code +krb5_get_default_realm ( + krb5_context /*context*/, + krb5_realm */*realm*/); + +krb5_error_code +krb5_get_default_realms ( + krb5_context /*context*/, + krb5_realm **/*realms*/); + +const char * +krb5_get_err_text ( + krb5_context /*context*/, + krb5_error_code /*code*/); + +char* +krb5_get_error_string (krb5_context /*context*/); + +krb5_error_code +krb5_get_extra_addresses ( + krb5_context /*context*/, + krb5_addresses */*addresses*/); + +krb5_error_code +krb5_get_fcache_version ( + krb5_context /*context*/, + int */*version*/); + +krb5_error_code +krb5_get_forwarded_creds ( + krb5_context /*context*/, + krb5_auth_context /*auth_context*/, + krb5_ccache /*ccache*/, + krb5_flags /*flags*/, + const char */*hostname*/, + krb5_creds */*in_creds*/, + krb5_data */*out_data*/); + +krb5_error_code +krb5_get_host_realm ( + krb5_context /*context*/, + const char */*host*/, + krb5_realm **/*realms*/); + +krb5_error_code +krb5_get_host_realm_int ( + krb5_context /*context*/, + const char */*host*/, + krb5_boolean /*use_dns*/, + krb5_realm **/*realms*/); + +krb5_error_code +krb5_get_ignore_addresses ( + krb5_context /*context*/, + krb5_addresses */*addresses*/); + +krb5_error_code +krb5_get_in_cred ( + krb5_context /*context*/, + krb5_flags /*options*/, + const krb5_addresses */*addrs*/, + const krb5_enctype */*etypes*/, + const krb5_preauthtype */*ptypes*/, + const krb5_preauthdata */*preauth*/, + krb5_key_proc /*key_proc*/, + krb5_const_pointer /*keyseed*/, + krb5_decrypt_proc /*decrypt_proc*/, + krb5_const_pointer /*decryptarg*/, + krb5_creds */*creds*/, + krb5_kdc_rep */*ret_as_reply*/); + +krb5_error_code +krb5_get_in_tkt ( + krb5_context /*context*/, + krb5_flags /*options*/, + const krb5_addresses */*addrs*/, + const krb5_enctype */*etypes*/, + const krb5_preauthtype */*ptypes*/, + krb5_key_proc /*key_proc*/, + krb5_const_pointer /*keyseed*/, + krb5_decrypt_proc /*decrypt_proc*/, + krb5_const_pointer /*decryptarg*/, + krb5_creds */*creds*/, + krb5_ccache /*ccache*/, + krb5_kdc_rep */*ret_as_reply*/); + +krb5_error_code +krb5_get_in_tkt_with_keytab ( + krb5_context /*context*/, + krb5_flags /*options*/, + krb5_addresses */*addrs*/, + const krb5_enctype */*etypes*/, + const krb5_preauthtype */*pre_auth_types*/, + krb5_keytab /*keytab*/, + krb5_ccache /*ccache*/, + krb5_creds */*creds*/, + krb5_kdc_rep */*ret_as_reply*/); + +krb5_error_code +krb5_get_in_tkt_with_password ( + krb5_context /*context*/, + krb5_flags /*options*/, + krb5_addresses */*addrs*/, + const krb5_enctype */*etypes*/, + const krb5_preauthtype */*pre_auth_types*/, + const char */*password*/, + krb5_ccache /*ccache*/, + krb5_creds */*creds*/, + krb5_kdc_rep */*ret_as_reply*/); + +krb5_error_code +krb5_get_in_tkt_with_skey ( + krb5_context /*context*/, + krb5_flags /*options*/, + krb5_addresses */*addrs*/, + const krb5_enctype */*etypes*/, + const krb5_preauthtype */*pre_auth_types*/, + const krb5_keyblock */*key*/, + krb5_ccache /*ccache*/, + krb5_creds */*creds*/, + krb5_kdc_rep */*ret_as_reply*/); + +krb5_error_code +krb5_get_init_creds_keytab ( + krb5_context /*context*/, + krb5_creds */*creds*/, + krb5_principal /*client*/, + krb5_keytab /*keytab*/, + krb5_deltat /*start_time*/, + const char */*in_tkt_service*/, + krb5_get_init_creds_opt */*options*/); + +void +krb5_get_init_creds_opt_init (krb5_get_init_creds_opt */*opt*/); + +void +krb5_get_init_creds_opt_set_address_list ( + krb5_get_init_creds_opt */*opt*/, + krb5_addresses */*addresses*/); + +void +krb5_get_init_creds_opt_set_anonymous ( + krb5_get_init_creds_opt */*opt*/, + int /*anonymous*/); + +void +krb5_get_init_creds_opt_set_default_flags ( + krb5_context /*context*/, + const char */*appname*/, + krb5_const_realm /*realm*/, + krb5_get_init_creds_opt */*opt*/); + +void +krb5_get_init_creds_opt_set_etype_list ( + krb5_get_init_creds_opt */*opt*/, + krb5_enctype */*etype_list*/, + int /*etype_list_length*/); + +void +krb5_get_init_creds_opt_set_forwardable ( + krb5_get_init_creds_opt */*opt*/, + int /*forwardable*/); + +void +krb5_get_init_creds_opt_set_preauth_list ( + krb5_get_init_creds_opt */*opt*/, + krb5_preauthtype */*preauth_list*/, + int /*preauth_list_length*/); + +void +krb5_get_init_creds_opt_set_proxiable ( + krb5_get_init_creds_opt */*opt*/, + int /*proxiable*/); + +void +krb5_get_init_creds_opt_set_renew_life ( + krb5_get_init_creds_opt */*opt*/, + krb5_deltat /*renew_life*/); + +void +krb5_get_init_creds_opt_set_salt ( + krb5_get_init_creds_opt */*opt*/, + krb5_data */*salt*/); + +void +krb5_get_init_creds_opt_set_tkt_life ( + krb5_get_init_creds_opt */*opt*/, + krb5_deltat /*tkt_life*/); + +krb5_error_code +krb5_get_init_creds_password ( + krb5_context /*context*/, + krb5_creds */*creds*/, + krb5_principal /*client*/, + const char */*password*/, + krb5_prompter_fct /*prompter*/, + void */*data*/, + krb5_deltat /*start_time*/, + const char */*in_tkt_service*/, + krb5_get_init_creds_opt */*options*/); + +krb5_error_code +krb5_get_kdc_cred ( + krb5_context /*context*/, + krb5_ccache /*id*/, + krb5_kdc_flags /*flags*/, + krb5_addresses */*addresses*/, + Ticket */*second_ticket*/, + krb5_creds */*in_creds*/, + krb5_creds **out_creds ); + +krb5_error_code +krb5_get_krb524hst ( + krb5_context /*context*/, + const krb5_realm */*realm*/, + char ***/*hostlist*/); + +krb5_error_code +krb5_get_krb_admin_hst ( + krb5_context /*context*/, + const krb5_realm */*realm*/, + char ***/*hostlist*/); + +krb5_error_code +krb5_get_krb_changepw_hst ( + krb5_context /*context*/, + const krb5_realm */*realm*/, + char ***/*hostlist*/); + +krb5_error_code +krb5_get_krbhst ( + krb5_context /*context*/, + const krb5_realm */*realm*/, + char ***/*hostlist*/); + +krb5_error_code +krb5_get_pw_salt ( + krb5_context /*context*/, + krb5_const_principal /*principal*/, + krb5_salt */*salt*/); + +krb5_error_code +krb5_get_server_rcache ( + krb5_context /*context*/, + const krb5_data */*piece*/, + krb5_rcache */*id*/); + +krb5_boolean +krb5_get_use_admin_kdc (krb5_context /*context*/); + +size_t +krb5_get_wrapped_length ( + krb5_context /*context*/, + krb5_crypto /*crypto*/, + size_t /*data_len*/); + +int +krb5_getportbyname ( + krb5_context /*context*/, + const char */*service*/, + const char */*proto*/, + int /*default_port*/); + +krb5_error_code +krb5_h_addr2addr ( + krb5_context /*context*/, + int /*af*/, + const char */*haddr*/, + krb5_address */*addr*/); + +krb5_error_code +krb5_h_addr2sockaddr ( + krb5_context /*context*/, + int /*af*/, + const char */*addr*/, + struct sockaddr */*sa*/, + krb5_socklen_t */*sa_size*/, + int /*port*/); + +krb5_error_code +krb5_h_errno_to_heim_errno (int /*eai_errno*/); + +krb5_boolean +krb5_have_error_string (krb5_context /*context*/); + +krb5_error_code +krb5_hmac ( + krb5_context /*context*/, + krb5_cksumtype /*cktype*/, + const void */*data*/, + size_t /*len*/, + unsigned /*usage*/, + krb5_keyblock */*key*/, + Checksum */*result*/); + +krb5_error_code +krb5_init_context (krb5_context */*context*/); + +void +krb5_init_ets (krb5_context /*context*/); + +krb5_error_code +krb5_init_etype ( + krb5_context /*context*/, + unsigned */*len*/, + krb5_enctype **/*val*/, + const krb5_enctype */*etypes*/); + +krb5_error_code +krb5_initlog ( + krb5_context /*context*/, + const char */*program*/, + krb5_log_facility **/*fac*/); + +krb5_error_code +krb5_keyblock_key_proc ( + krb5_context /*context*/, + krb5_keytype /*type*/, + krb5_data */*salt*/, + krb5_const_pointer /*keyseed*/, + krb5_keyblock **/*key*/); + +krb5_error_code +krb5_keytab_key_proc ( + krb5_context /*context*/, + krb5_enctype /*enctype*/, + krb5_salt /*salt*/, + krb5_const_pointer /*keyseed*/, + krb5_keyblock **/*key*/); + +krb5_error_code +krb5_keytype_to_enctypes ( + krb5_context /*context*/, + krb5_keytype /*keytype*/, + unsigned */*len*/, + krb5_enctype **/*val*/); + +krb5_error_code +krb5_keytype_to_enctypes_default ( + krb5_context /*context*/, + krb5_keytype /*keytype*/, + unsigned */*len*/, + krb5_enctype **/*val*/); + +krb5_error_code +krb5_keytype_to_string ( + krb5_context /*context*/, + krb5_keytype /*keytype*/, + char **/*string*/); + +krb5_error_code +krb5_krbhst_format_string ( + krb5_context /*context*/, + const krb5_krbhst_info */*host*/, + char */*hostname*/, + size_t /*hostlen*/); + +void +krb5_krbhst_free ( + krb5_context /*context*/, + krb5_krbhst_handle /*handle*/); + +krb5_error_code +krb5_krbhst_get_addrinfo ( + krb5_context /*context*/, + krb5_krbhst_info */*host*/, + struct addrinfo **/*ai*/); + +krb5_error_code +krb5_krbhst_init ( + krb5_context /*context*/, + const char */*realm*/, + unsigned int /*type*/, + krb5_krbhst_handle */*handle*/); + +krb5_error_code +krb5_krbhst_next ( + krb5_context /*context*/, + krb5_krbhst_handle /*handle*/, + krb5_krbhst_info **/*host*/); + +krb5_error_code +krb5_krbhst_next_as_string ( + krb5_context /*context*/, + krb5_krbhst_handle /*handle*/, + char */*hostname*/, + size_t /*hostlen*/); + +void +krb5_krbhst_reset ( + krb5_context /*context*/, + krb5_krbhst_handle /*handle*/); + +krb5_error_code +krb5_kt_add_entry ( + krb5_context /*context*/, + krb5_keytab /*id*/, + krb5_keytab_entry */*entry*/); + +krb5_error_code +krb5_kt_close ( + krb5_context /*context*/, + krb5_keytab /*id*/); + +krb5_boolean +krb5_kt_compare ( + krb5_context /*context*/, + krb5_keytab_entry */*entry*/, + krb5_const_principal /*principal*/, + krb5_kvno /*vno*/, + krb5_enctype /*enctype*/); + +krb5_error_code +krb5_kt_copy_entry_contents ( + krb5_context /*context*/, + const krb5_keytab_entry */*in*/, + krb5_keytab_entry */*out*/); + +krb5_error_code +krb5_kt_default ( + krb5_context /*context*/, + krb5_keytab */*id*/); + +krb5_error_code +krb5_kt_default_modify_name ( + krb5_context /*context*/, + char */*name*/, + size_t /*namesize*/); + +krb5_error_code +krb5_kt_default_name ( + krb5_context /*context*/, + char */*name*/, + size_t /*namesize*/); + +krb5_error_code +krb5_kt_end_seq_get ( + krb5_context /*context*/, + krb5_keytab /*id*/, + krb5_kt_cursor */*cursor*/); + +krb5_error_code +krb5_kt_free_entry ( + krb5_context /*context*/, + krb5_keytab_entry */*entry*/); + +krb5_error_code +krb5_kt_get_entry ( + krb5_context /*context*/, + krb5_keytab /*id*/, + krb5_const_principal /*principal*/, + krb5_kvno /*kvno*/, + krb5_enctype /*enctype*/, + krb5_keytab_entry */*entry*/); + +krb5_error_code +krb5_kt_get_name ( + krb5_context /*context*/, + krb5_keytab /*keytab*/, + char */*name*/, + size_t /*namesize*/); + +krb5_error_code +krb5_kt_get_type ( + krb5_context /*context*/, + krb5_keytab /*keytab*/, + char */*prefix*/, + size_t /*prefixsize*/); + +krb5_error_code +krb5_kt_next_entry ( + krb5_context /*context*/, + krb5_keytab /*id*/, + krb5_keytab_entry */*entry*/, + krb5_kt_cursor */*cursor*/); + +krb5_error_code +krb5_kt_read_service_key ( + krb5_context /*context*/, + krb5_pointer /*keyprocarg*/, + krb5_principal /*principal*/, + krb5_kvno /*vno*/, + krb5_enctype /*enctype*/, + krb5_keyblock **/*key*/); + +krb5_error_code +krb5_kt_register ( + krb5_context /*context*/, + const krb5_kt_ops */*ops*/); + +krb5_error_code +krb5_kt_remove_entry ( + krb5_context /*context*/, + krb5_keytab /*id*/, + krb5_keytab_entry */*entry*/); + +krb5_error_code +krb5_kt_resolve ( + krb5_context /*context*/, + const char */*name*/, + krb5_keytab */*id*/); + +krb5_error_code +krb5_kt_start_seq_get ( + krb5_context /*context*/, + krb5_keytab /*id*/, + krb5_kt_cursor */*cursor*/); + +krb5_boolean +krb5_kuserok ( + krb5_context /*context*/, + krb5_principal /*principal*/, + const char */*luser*/); + +krb5_error_code +krb5_log ( + krb5_context /*context*/, + krb5_log_facility */*fac*/, + int /*level*/, + const char */*fmt*/, + ...) + __attribute__((format (printf, 4, 5))); + +krb5_error_code +krb5_log_msg ( + krb5_context /*context*/, + krb5_log_facility */*fac*/, + int /*level*/, + char **/*reply*/, + const char */*fmt*/, + ...) + __attribute__((format (printf, 5, 6))); + +krb5_error_code +krb5_make_addrport ( + krb5_context /*context*/, + krb5_address **/*res*/, + const krb5_address */*addr*/, + int16_t /*port*/); + +krb5_error_code +krb5_make_principal ( + krb5_context /*context*/, + krb5_principal */*principal*/, + krb5_const_realm /*realm*/, + ...); + +size_t +krb5_max_sockaddr_size (void); + +krb5_error_code +krb5_mk_error ( + krb5_context /*context*/, + krb5_error_code /*error_code*/, + const char */*e_text*/, + const krb5_data */*e_data*/, + const krb5_principal /*client*/, + const krb5_principal /*server*/, + time_t */*client_time*/, + int */*client_usec*/, + krb5_data */*reply*/); + +krb5_error_code +krb5_mk_priv ( + krb5_context /*context*/, + krb5_auth_context /*auth_context*/, + const krb5_data */*userdata*/, + krb5_data */*outbuf*/, + void */*outdata*/); + +krb5_error_code +krb5_mk_rep ( + krb5_context /*context*/, + krb5_auth_context /*auth_context*/, + krb5_data */*outbuf*/); + +krb5_error_code +krb5_mk_req ( + krb5_context /*context*/, + krb5_auth_context */*auth_context*/, + const krb5_flags /*ap_req_options*/, + const char */*service*/, + const char */*hostname*/, + krb5_data */*in_data*/, + krb5_ccache /*ccache*/, + krb5_data */*outbuf*/); + +krb5_error_code +krb5_mk_req_exact ( + krb5_context /*context*/, + krb5_auth_context */*auth_context*/, + const krb5_flags /*ap_req_options*/, + const krb5_principal /*server*/, + krb5_data */*in_data*/, + krb5_ccache /*ccache*/, + krb5_data */*outbuf*/); + +krb5_error_code +krb5_mk_req_extended ( + krb5_context /*context*/, + krb5_auth_context */*auth_context*/, + const krb5_flags /*ap_req_options*/, + krb5_data */*in_data*/, + krb5_creds */*in_creds*/, + krb5_data */*outbuf*/); + +krb5_error_code +krb5_mk_req_internal ( + krb5_context /*context*/, + krb5_auth_context */*auth_context*/, + const krb5_flags /*ap_req_options*/, + krb5_data */*in_data*/, + krb5_creds */*in_creds*/, + krb5_data */*outbuf*/, + krb5_key_usage /*checksum_usage*/, + krb5_key_usage /*encrypt_usage*/); + +krb5_error_code +krb5_mk_safe ( + krb5_context /*context*/, + krb5_auth_context /*auth_context*/, + const krb5_data */*userdata*/, + krb5_data */*outbuf*/, + void */*outdata*/); + +krb5_ssize_t +krb5_net_read ( + krb5_context /*context*/, + void */*p_fd*/, + void */*buf*/, + size_t /*len*/); + +krb5_ssize_t +krb5_net_write ( + krb5_context /*context*/, + void */*p_fd*/, + const void */*buf*/, + size_t /*len*/); + +krb5_error_code +krb5_openlog ( + krb5_context /*context*/, + const char */*program*/, + krb5_log_facility **/*fac*/); + +krb5_error_code +krb5_parse_address ( + krb5_context /*context*/, + const char */*string*/, + krb5_addresses */*addresses*/); + +krb5_error_code +krb5_parse_name ( + krb5_context /*context*/, + const char */*name*/, + krb5_principal */*principal*/); + +const char* +krb5_passwd_result_to_string ( + krb5_context /*context*/, + int /*result*/); + +krb5_error_code +krb5_password_key_proc ( + krb5_context /*context*/, + krb5_enctype /*type*/, + krb5_salt /*salt*/, + krb5_const_pointer /*keyseed*/, + krb5_keyblock **/*key*/); + +krb5_realm* +krb5_princ_realm ( + krb5_context /*context*/, + krb5_principal /*principal*/); + +void +krb5_princ_set_realm ( + krb5_context /*context*/, + krb5_principal /*principal*/, + krb5_realm */*realm*/); + +krb5_error_code +krb5_principal2principalname ( + PrincipalName */*p*/, + const krb5_principal /*from*/); + +krb5_boolean +krb5_principal_compare ( + krb5_context /*context*/, + krb5_const_principal /*princ1*/, + krb5_const_principal /*princ2*/); + +krb5_boolean +krb5_principal_compare_any_realm ( + krb5_context /*context*/, + krb5_const_principal /*princ1*/, + krb5_const_principal /*princ2*/); + +const char * +krb5_principal_get_comp_string ( + krb5_context /*context*/, + krb5_principal /*principal*/, + unsigned int /*component*/); + +const char * +krb5_principal_get_realm ( + krb5_context /*context*/, + krb5_principal /*principal*/); + +int +krb5_principal_get_type ( + krb5_context /*context*/, + krb5_principal /*principal*/); + +krb5_boolean +krb5_principal_match ( + krb5_context /*context*/, + krb5_const_principal /*princ*/, + krb5_const_principal /*pattern*/); + +krb5_error_code +krb5_print_address ( + const krb5_address */*addr*/, + char */*str*/, + size_t /*len*/, + size_t */*ret_len*/); + +int +krb5_program_setup ( + krb5_context */*context*/, + int /*argc*/, + char **/*argv*/, + struct getargs */*args*/, + int /*num_args*/, + void (*/*usage*/)(int, struct getargs*, int)); + +int +krb5_prompter_posix ( + krb5_context /*context*/, + void */*data*/, + const char */*name*/, + const char */*banner*/, + int /*num_prompts*/, + krb5_prompt prompts[]); + +krb5_error_code +krb5_rc_close ( + krb5_context /*context*/, + krb5_rcache /*id*/); + +krb5_error_code +krb5_rc_default ( + krb5_context /*context*/, + krb5_rcache */*id*/); + +const char * +krb5_rc_default_name (krb5_context /*context*/); + +const char * +krb5_rc_default_type (krb5_context /*context*/); + +krb5_error_code +krb5_rc_destroy ( + krb5_context /*context*/, + krb5_rcache /*id*/); + +krb5_error_code +krb5_rc_expunge ( + krb5_context /*context*/, + krb5_rcache /*id*/); + +krb5_error_code +krb5_rc_get_lifespan ( + krb5_context /*context*/, + krb5_rcache /*id*/, + krb5_deltat */*auth_lifespan*/); + +const char* +krb5_rc_get_name ( + krb5_context /*context*/, + krb5_rcache /*id*/); + +const char* +krb5_rc_get_type ( + krb5_context /*context*/, + krb5_rcache /*id*/); + +krb5_error_code +krb5_rc_initialize ( + krb5_context /*context*/, + krb5_rcache /*id*/, + krb5_deltat /*auth_lifespan*/); + +krb5_error_code +krb5_rc_recover ( + krb5_context /*context*/, + krb5_rcache /*id*/); + +krb5_error_code +krb5_rc_resolve ( + krb5_context /*context*/, + krb5_rcache /*id*/, + const char */*name*/); + +krb5_error_code +krb5_rc_resolve_full ( + krb5_context /*context*/, + krb5_rcache */*id*/, + const char */*string_name*/); + +krb5_error_code +krb5_rc_resolve_type ( + krb5_context /*context*/, + krb5_rcache */*id*/, + const char */*type*/); + +krb5_error_code +krb5_rc_store ( + krb5_context /*context*/, + krb5_rcache /*id*/, + krb5_donot_replay */*rep*/); + +krb5_error_code +krb5_rd_cred ( + krb5_context /*context*/, + krb5_auth_context /*auth_context*/, + krb5_data */*in_data*/, + krb5_creds ***/*ret_creds*/, + krb5_replay_data */*out_data*/); + +krb5_error_code +krb5_rd_cred2 ( + krb5_context /*context*/, + krb5_auth_context /*auth_context*/, + krb5_ccache /*ccache*/, + krb5_data */*in_data*/); + +krb5_error_code +krb5_rd_error ( + krb5_context /*context*/, + krb5_data */*msg*/, + KRB_ERROR */*result*/); + +krb5_error_code +krb5_rd_priv ( + krb5_context /*context*/, + krb5_auth_context /*auth_context*/, + const krb5_data */*inbuf*/, + krb5_data */*outbuf*/, + void */*outdata*/); + +krb5_error_code +krb5_rd_rep ( + krb5_context /*context*/, + krb5_auth_context /*auth_context*/, + const krb5_data */*inbuf*/, + krb5_ap_rep_enc_part **/*repl*/); + +krb5_error_code +krb5_rd_req ( + krb5_context /*context*/, + krb5_auth_context */*auth_context*/, + const krb5_data */*inbuf*/, + krb5_const_principal /*server*/, + krb5_keytab /*keytab*/, + krb5_flags */*ap_req_options*/, + krb5_ticket **/*ticket*/); + +krb5_error_code +krb5_rd_req_with_keyblock ( + krb5_context /*context*/, + krb5_auth_context */*auth_context*/, + const krb5_data */*inbuf*/, + krb5_const_principal /*server*/, + krb5_keyblock */*keyblock*/, + krb5_flags */*ap_req_options*/, + krb5_ticket **/*ticket*/); + +krb5_error_code +krb5_rd_safe ( + krb5_context /*context*/, + krb5_auth_context /*auth_context*/, + const krb5_data */*inbuf*/, + krb5_data */*outbuf*/, + void */*outdata*/); + +krb5_error_code +krb5_read_message ( + krb5_context /*context*/, + krb5_pointer /*p_fd*/, + krb5_data */*data*/); + +krb5_error_code +krb5_read_priv_message ( + krb5_context /*context*/, + krb5_auth_context /*ac*/, + krb5_pointer /*p_fd*/, + krb5_data */*data*/); + +krb5_error_code +krb5_read_safe_message ( + krb5_context /*context*/, + krb5_auth_context /*ac*/, + krb5_pointer /*p_fd*/, + krb5_data */*data*/); + +krb5_boolean +krb5_realm_compare ( + krb5_context /*context*/, + krb5_const_principal /*princ1*/, + krb5_const_principal /*princ2*/); + +krb5_error_code +krb5_recvauth ( + krb5_context /*context*/, + krb5_auth_context */*auth_context*/, + krb5_pointer /*p_fd*/, + const char */*appl_version*/, + krb5_principal /*server*/, + int32_t /*flags*/, + krb5_keytab /*keytab*/, + krb5_ticket **/*ticket*/); + +krb5_error_code +krb5_recvauth_match_version ( + krb5_context /*context*/, + krb5_auth_context */*auth_context*/, + krb5_pointer /*p_fd*/, + krb5_boolean (*/*match_appl_version*/)(const void *, const char*), + const void */*match_data*/, + krb5_principal /*server*/, + int32_t /*flags*/, + krb5_keytab /*keytab*/, + krb5_ticket **/*ticket*/); + +krb5_error_code +krb5_ret_address ( + krb5_storage */*sp*/, + krb5_address */*adr*/); + +krb5_error_code +krb5_ret_addrs ( + krb5_storage */*sp*/, + krb5_addresses */*adr*/); + +krb5_error_code +krb5_ret_authdata ( + krb5_storage */*sp*/, + krb5_authdata */*auth*/); + +krb5_error_code +krb5_ret_creds ( + krb5_storage */*sp*/, + krb5_creds */*creds*/); + +krb5_error_code +krb5_ret_data ( + krb5_storage */*sp*/, + krb5_data */*data*/); + +krb5_error_code +krb5_ret_int16 ( + krb5_storage */*sp*/, + int16_t */*value*/); + +krb5_error_code +krb5_ret_int32 ( + krb5_storage */*sp*/, + int32_t */*value*/); + +krb5_error_code +krb5_ret_int8 ( + krb5_storage */*sp*/, + int8_t */*value*/); + +krb5_error_code +krb5_ret_keyblock ( + krb5_storage */*sp*/, + krb5_keyblock */*p*/); + +krb5_error_code +krb5_ret_principal ( + krb5_storage */*sp*/, + krb5_principal */*princ*/); + +krb5_error_code +krb5_ret_string ( + krb5_storage */*sp*/, + char **/*string*/); + +krb5_error_code +krb5_ret_stringz ( + krb5_storage */*sp*/, + char **/*string*/); + +krb5_error_code +krb5_ret_times ( + krb5_storage */*sp*/, + krb5_times */*times*/); + +krb5_error_code +krb5_salttype_to_string ( + krb5_context /*context*/, + krb5_enctype /*etype*/, + krb5_salttype /*stype*/, + char **/*string*/); + +krb5_error_code +krb5_sendauth ( + krb5_context /*context*/, + krb5_auth_context */*auth_context*/, + krb5_pointer /*p_fd*/, + const char */*appl_version*/, + krb5_principal /*client*/, + krb5_principal /*server*/, + krb5_flags /*ap_req_options*/, + krb5_data */*in_data*/, + krb5_creds */*in_creds*/, + krb5_ccache /*ccache*/, + krb5_error **/*ret_error*/, + krb5_ap_rep_enc_part **/*rep_result*/, + krb5_creds **/*out_creds*/); + +krb5_error_code +krb5_sendto ( + krb5_context /*context*/, + const krb5_data */*send_data*/, + krb5_krbhst_handle /*handle*/, + krb5_data */*receive*/); + +krb5_error_code +krb5_sendto_kdc ( + krb5_context /*context*/, + const krb5_data */*send_data*/, + const krb5_realm */*realm*/, + krb5_data */*receive*/); + +krb5_error_code +krb5_sendto_kdc2 ( + krb5_context /*context*/, + const krb5_data */*send_data*/, + const krb5_realm */*realm*/, + krb5_data */*receive*/, + krb5_boolean /*master*/); + +krb5_error_code +krb5_set_config_files ( + krb5_context /*context*/, + char **/*filenames*/); + +krb5_error_code +krb5_set_default_in_tkt_etypes ( + krb5_context /*context*/, + const krb5_enctype */*etypes*/); + +krb5_error_code +krb5_set_default_realm ( + krb5_context /*context*/, + const char */*realm*/); + +krb5_error_code +krb5_set_error_string ( + krb5_context /*context*/, + const char */*fmt*/, + ...) + __attribute__((format (printf, 2, 3))); + +krb5_error_code +krb5_set_extra_addresses ( + krb5_context /*context*/, + const krb5_addresses */*addresses*/); + +krb5_error_code +krb5_set_fcache_version ( + krb5_context /*context*/, + int /*version*/); + +krb5_error_code +krb5_set_ignore_addresses ( + krb5_context /*context*/, + const krb5_addresses */*addresses*/); + +krb5_error_code +krb5_set_password ( + krb5_context /*context*/, + krb5_creds */*creds*/, + char */*newpw*/, + krb5_principal /*targprinc*/, + int */*result_code*/, + krb5_data */*result_code_string*/, + krb5_data */*result_string*/); + +krb5_error_code +krb5_set_password_using_ccache ( + krb5_context /*context*/, + krb5_ccache /*ccache*/, + char */*newpw*/, + krb5_principal /*targprinc*/, + int */*result_code*/, + krb5_data */*result_code_string*/, + krb5_data */*result_string*/); + +void +krb5_set_use_admin_kdc ( + krb5_context /*context*/, + krb5_boolean /*flag*/); + +krb5_error_code +krb5_set_warn_dest ( + krb5_context /*context*/, + krb5_log_facility */*fac*/); + +krb5_error_code +krb5_sname_to_principal ( + krb5_context /*context*/, + const char */*hostname*/, + const char */*sname*/, + int32_t /*type*/, + krb5_principal */*ret_princ*/); + +krb5_error_code +krb5_sock_to_principal ( + krb5_context /*context*/, + int /*sock*/, + const char */*sname*/, + int32_t /*type*/, + krb5_principal */*ret_princ*/); + +krb5_error_code +krb5_sockaddr2address ( + krb5_context /*context*/, + const struct sockaddr */*sa*/, + krb5_address */*addr*/); + +krb5_error_code +krb5_sockaddr2port ( + krb5_context /*context*/, + const struct sockaddr */*sa*/, + int16_t */*port*/); + +krb5_boolean +krb5_sockaddr_uninteresting (const struct sockaddr */*sa*/); + +void +krb5_std_usage ( + int /*code*/, + struct getargs */*args*/, + int /*num_args*/); + +void +krb5_storage_clear_flags ( + krb5_storage */*sp*/, + krb5_flags /*flags*/); + +krb5_storage * +krb5_storage_emem (void); + +krb5_error_code +krb5_storage_free (krb5_storage */*sp*/); + +krb5_storage * +krb5_storage_from_data (krb5_data */*data*/); + +krb5_storage * +krb5_storage_from_fd (int /*fd*/); + +krb5_storage * +krb5_storage_from_mem ( + void */*buf*/, + size_t /*len*/); + +krb5_flags +krb5_storage_get_byteorder ( + krb5_storage */*sp*/, + krb5_flags /*byteorder*/); + +krb5_boolean +krb5_storage_is_flags ( + krb5_storage */*sp*/, + krb5_flags /*flags*/); + +krb5_ssize_t +krb5_storage_read ( + krb5_storage */*sp*/, + void */*buf*/, + size_t /*len*/); + +off_t +krb5_storage_seek ( + krb5_storage */*sp*/, + off_t /*offset*/, + int /*whence*/); + +void +krb5_storage_set_byteorder ( + krb5_storage */*sp*/, + krb5_flags /*byteorder*/); + +void +krb5_storage_set_eof_code ( + krb5_storage */*sp*/, + int /*code*/); + +void +krb5_storage_set_flags ( + krb5_storage */*sp*/, + krb5_flags /*flags*/); + +krb5_error_code +krb5_storage_to_data ( + krb5_storage */*sp*/, + krb5_data */*data*/); + +krb5_ssize_t +krb5_storage_write ( + krb5_storage */*sp*/, + const void */*buf*/, + size_t /*len*/); + +krb5_error_code +krb5_store_address ( + krb5_storage */*sp*/, + krb5_address /*p*/); + +krb5_error_code +krb5_store_addrs ( + krb5_storage */*sp*/, + krb5_addresses /*p*/); + +krb5_error_code +krb5_store_authdata ( + krb5_storage */*sp*/, + krb5_authdata /*auth*/); + +krb5_error_code +krb5_store_creds ( + krb5_storage */*sp*/, + krb5_creds */*creds*/); + +krb5_error_code +krb5_store_data ( + krb5_storage */*sp*/, + krb5_data /*data*/); + +krb5_error_code +krb5_store_int16 ( + krb5_storage */*sp*/, + int16_t /*value*/); + +krb5_error_code +krb5_store_int32 ( + krb5_storage */*sp*/, + int32_t /*value*/); + +krb5_error_code +krb5_store_int8 ( + krb5_storage */*sp*/, + int8_t /*value*/); + +krb5_error_code +krb5_store_keyblock ( + krb5_storage */*sp*/, + krb5_keyblock /*p*/); + +krb5_error_code +krb5_store_principal ( + krb5_storage */*sp*/, + krb5_principal /*p*/); + +krb5_error_code +krb5_store_string ( + krb5_storage */*sp*/, + const char */*s*/); + +krb5_error_code +krb5_store_stringz ( + krb5_storage */*sp*/, + const char */*s*/); + +krb5_error_code +krb5_store_times ( + krb5_storage */*sp*/, + krb5_times /*times*/); + +krb5_error_code +krb5_string_to_deltat ( + const char */*string*/, + krb5_deltat */*deltat*/); + +krb5_error_code +krb5_string_to_enctype ( + krb5_context /*context*/, + const char */*string*/, + krb5_enctype */*etype*/); + +krb5_error_code +krb5_string_to_key ( + krb5_context /*context*/, + krb5_enctype /*enctype*/, + const char */*password*/, + krb5_principal /*principal*/, + krb5_keyblock */*key*/); + +krb5_error_code +krb5_string_to_key_data ( + krb5_context /*context*/, + krb5_enctype /*enctype*/, + krb5_data /*password*/, + krb5_principal /*principal*/, + krb5_keyblock */*key*/); + +krb5_error_code +krb5_string_to_key_data_salt ( + krb5_context /*context*/, + krb5_enctype /*enctype*/, + krb5_data /*password*/, + krb5_salt /*salt*/, + krb5_keyblock */*key*/); + +krb5_error_code +krb5_string_to_key_data_salt_opaque ( + krb5_context /*context*/, + krb5_enctype /*enctype*/, + krb5_data /*password*/, + krb5_salt /*salt*/, + krb5_data /*opaque*/, + krb5_keyblock */*key*/); + +krb5_error_code +krb5_string_to_key_derived ( + krb5_context /*context*/, + const void */*str*/, + size_t /*len*/, + krb5_enctype /*etype*/, + krb5_keyblock */*key*/); + +krb5_error_code +krb5_string_to_key_salt ( + krb5_context /*context*/, + krb5_enctype /*enctype*/, + const char */*password*/, + krb5_salt /*salt*/, + krb5_keyblock */*key*/); + +krb5_error_code +krb5_string_to_keytype ( + krb5_context /*context*/, + const char */*string*/, + krb5_keytype */*keytype*/); + +krb5_error_code +krb5_string_to_salttype ( + krb5_context /*context*/, + krb5_enctype /*etype*/, + const char */*string*/, + krb5_salttype */*salttype*/); + +krb5_error_code +krb5_timeofday ( + krb5_context /*context*/, + krb5_timestamp */*timeret*/); + +krb5_error_code +krb5_unparse_name ( + krb5_context /*context*/, + krb5_const_principal /*principal*/, + char **/*name*/); + +krb5_error_code +krb5_unparse_name_fixed ( + krb5_context /*context*/, + krb5_const_principal /*principal*/, + char */*name*/, + size_t /*len*/); + +krb5_error_code +krb5_unparse_name_fixed_short ( + krb5_context /*context*/, + krb5_const_principal /*principal*/, + char */*name*/, + size_t /*len*/); + +krb5_error_code +krb5_unparse_name_short ( + krb5_context /*context*/, + krb5_const_principal /*principal*/, + char **/*name*/); + +krb5_error_code +krb5_us_timeofday ( + krb5_context /*context*/, + int32_t */*sec*/, + int32_t */*usec*/); + +krb5_error_code +krb5_vabort ( + krb5_context /*context*/, + krb5_error_code /*code*/, + const char */*fmt*/, + va_list /*ap*/) + __attribute__ ((noreturn, format (printf, 3, 0))); + +krb5_error_code +krb5_vabortx ( + krb5_context /*context*/, + const char */*fmt*/, + va_list /*ap*/) + __attribute__ ((noreturn, format (printf, 2, 0))); + +krb5_error_code +krb5_verify_ap_req ( + krb5_context /*context*/, + krb5_auth_context */*auth_context*/, + krb5_ap_req */*ap_req*/, + krb5_const_principal /*server*/, + krb5_keyblock */*keyblock*/, + krb5_flags /*flags*/, + krb5_flags */*ap_req_options*/, + krb5_ticket **/*ticket*/); + +krb5_error_code +krb5_verify_ap_req2 ( + krb5_context /*context*/, + krb5_auth_context */*auth_context*/, + krb5_ap_req */*ap_req*/, + krb5_const_principal /*server*/, + krb5_keyblock */*keyblock*/, + krb5_flags /*flags*/, + krb5_flags */*ap_req_options*/, + krb5_ticket **/*ticket*/, + krb5_key_usage /*usage*/); + +krb5_error_code +krb5_verify_authenticator_checksum ( + krb5_context /*context*/, + krb5_auth_context /*ac*/, + void */*data*/, + size_t /*len*/); + +krb5_error_code +krb5_verify_checksum ( + krb5_context /*context*/, + krb5_crypto /*crypto*/, + krb5_key_usage /*usage*/, + void */*data*/, + size_t /*len*/, + Checksum */*cksum*/); + +krb5_error_code +krb5_verify_init_creds ( + krb5_context /*context*/, + krb5_creds */*creds*/, + krb5_principal /*ap_req_server*/, + krb5_keytab /*ap_req_keytab*/, + krb5_ccache */*ccache*/, + krb5_verify_init_creds_opt */*options*/); + +void +krb5_verify_init_creds_opt_init (krb5_verify_init_creds_opt */*options*/); + +void +krb5_verify_init_creds_opt_set_ap_req_nofail ( + krb5_verify_init_creds_opt */*options*/, + int /*ap_req_nofail*/); + +void +krb5_verify_opt_init (krb5_verify_opt */*opt*/); + +void +krb5_verify_opt_set_ccache ( + krb5_verify_opt */*opt*/, + krb5_ccache /*ccache*/); + +void +krb5_verify_opt_set_flags ( + krb5_verify_opt */*opt*/, + unsigned int /*flags*/); + +void +krb5_verify_opt_set_keytab ( + krb5_verify_opt */*opt*/, + krb5_keytab /*keytab*/); + +void +krb5_verify_opt_set_secure ( + krb5_verify_opt */*opt*/, + krb5_boolean /*secure*/); + +void +krb5_verify_opt_set_service ( + krb5_verify_opt */*opt*/, + const char */*service*/); + +krb5_error_code +krb5_verify_user ( + krb5_context /*context*/, + krb5_principal /*principal*/, + krb5_ccache /*ccache*/, + const char */*password*/, + krb5_boolean /*secure*/, + const char */*service*/); + +krb5_error_code +krb5_verify_user_lrealm ( + krb5_context /*context*/, + krb5_principal /*principal*/, + krb5_ccache /*ccache*/, + const char */*password*/, + krb5_boolean /*secure*/, + const char */*service*/); + +krb5_error_code +krb5_verify_user_opt ( + krb5_context /*context*/, + krb5_principal /*principal*/, + const char */*password*/, + krb5_verify_opt */*opt*/); + +krb5_error_code +krb5_verr ( + krb5_context /*context*/, + int /*eval*/, + krb5_error_code /*code*/, + const char */*fmt*/, + va_list /*ap*/) + __attribute__ ((noreturn, format (printf, 4, 0))); + +krb5_error_code +krb5_verrx ( + krb5_context /*context*/, + int /*eval*/, + const char */*fmt*/, + va_list /*ap*/) + __attribute__ ((noreturn, format (printf, 3, 0))); + +krb5_error_code +krb5_vlog ( + krb5_context /*context*/, + krb5_log_facility */*fac*/, + int /*level*/, + const char */*fmt*/, + va_list /*ap*/) + __attribute__((format (printf, 4, 0))); + +krb5_error_code +krb5_vlog_msg ( + krb5_context /*context*/, + krb5_log_facility */*fac*/, + char **/*reply*/, + int /*level*/, + const char */*fmt*/, + va_list /*ap*/) + __attribute__((format (printf, 5, 0))); + +krb5_error_code +krb5_vset_error_string ( + krb5_context /*context*/, + const char */*fmt*/, + va_list /*args*/) + __attribute__ ((format (printf, 2, 0))); + +krb5_error_code +krb5_vwarn ( + krb5_context /*context*/, + krb5_error_code /*code*/, + const char */*fmt*/, + va_list /*ap*/) + __attribute__ ((format (printf, 3, 0))); + +krb5_error_code +krb5_vwarnx ( + krb5_context /*context*/, + const char */*fmt*/, + va_list /*ap*/) + __attribute__ ((format (printf, 2, 0))); + +krb5_error_code +krb5_warn ( + krb5_context /*context*/, + krb5_error_code /*code*/, + const char */*fmt*/, + ...) + __attribute__ ((format (printf, 3, 4))); + +krb5_error_code +krb5_warnx ( + krb5_context /*context*/, + const char */*fmt*/, + ...) + __attribute__ ((format (printf, 2, 3))); + +krb5_error_code +krb5_write_message ( + krb5_context /*context*/, + krb5_pointer /*p_fd*/, + krb5_data */*data*/); + +krb5_error_code +krb5_write_priv_message ( + krb5_context /*context*/, + krb5_auth_context /*ac*/, + krb5_pointer /*p_fd*/, + krb5_data */*data*/); + +krb5_error_code +krb5_write_safe_message ( + krb5_context /*context*/, + krb5_auth_context /*ac*/, + krb5_pointer /*p_fd*/, + krb5_data */*data*/); + +krb5_error_code +krb5_xfree (void */*ptr*/); + +krb5_error_code +principalname2krb5_principal ( + krb5_principal */*principal*/, + const PrincipalName /*from*/, + const Realm /*realm*/); + +#endif /* __krb5_protos_h__ */ diff --git a/src/include.new/krb5-types.h b/src/include.new/krb5-types.h new file mode 100644 index 0000000..16047f8 --- /dev/null +++ b/src/include.new/krb5-types.h @@ -0,0 +1,17 @@ +/* krb5-types.h -- this file was generated for i386-unknown-freebsd5.0 by + $Id$ */ + +/* $FreeBSD: src/kerberos5/include/krb5-types.h,v 1.3 2002/08/30 21:33:16 nectar Exp $ */ + +#ifndef __krb5_types_h__ +#define __krb5_types_h__ + +#include +#include +#include + +typedef socklen_t krb5_socklen_t; +#include +typedef ssize_t krb5_ssize_t; + +#endif /* __krb5_types_h__ */ diff --git a/src/include.new/krb5.h b/src/include.new/krb5.h new file mode 100644 index 0000000..cef7979 --- /dev/null +++ b/src/include.new/krb5.h @@ -0,0 +1,683 @@ +/* + * Copyright (c) 1997 - 2002 Kungliga Tekniska H�gskolan + * (Royal Institute of Technology, Stockholm, Sweden). + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of the Institute nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* $Id$ */ + +#ifndef __KRB5_H__ +#define __KRB5_H__ + +#include +#include + +#include +#include +#include +#include + +#include + +/* name confusion with MIT */ +#ifndef KRB5KDC_ERR_KEY_EXP +#define KRB5KDC_ERR_KEY_EXP KRB5KDC_ERR_KEY_EXPIRED +#endif + +/* simple constants */ + +#ifndef TRUE +#define TRUE 1 +#define FALSE 0 +#endif + +typedef int krb5_boolean; + +typedef int32_t krb5_error_code; + +typedef int krb5_kvno; + +typedef u_int32_t krb5_flags; + +typedef void *krb5_pointer; +typedef const void *krb5_const_pointer; + +typedef octet_string krb5_data; + +struct krb5_crypto_data; +typedef struct krb5_crypto_data *krb5_crypto; + +typedef CKSUMTYPE krb5_cksumtype; + +typedef Checksum krb5_checksum; + +typedef ENCTYPE krb5_enctype; + +/* alternative names */ +enum { + ENCTYPE_NULL = ETYPE_NULL, + ENCTYPE_DES_CBC_CRC = ETYPE_DES_CBC_CRC, + ENCTYPE_DES_CBC_MD4 = ETYPE_DES_CBC_MD4, + ENCTYPE_DES_CBC_MD5 = ETYPE_DES_CBC_MD5, + ENCTYPE_DES3_CBC_MD5 = ETYPE_DES3_CBC_MD5, + ENCTYPE_OLD_DES3_CBC_SHA1 = ETYPE_OLD_DES3_CBC_SHA1, + ENCTYPE_SIGN_DSA_GENERATE = ETYPE_SIGN_DSA_GENERATE, + ENCTYPE_ENCRYPT_RSA_PRIV = ETYPE_ENCRYPT_RSA_PRIV, + ENCTYPE_ENCRYPT_RSA_PUB = ETYPE_ENCRYPT_RSA_PUB, + ENCTYPE_DES3_CBC_SHA1 = ETYPE_DES3_CBC_SHA1, + ENCTYPE_ARCFOUR_HMAC_MD5 = ETYPE_ARCFOUR_HMAC_MD5, + ENCTYPE_ARCFOUR_HMAC_MD5_56 = ETYPE_ARCFOUR_HMAC_MD5_56, + ENCTYPE_ENCTYPE_PK_CROSS = ETYPE_ENCTYPE_PK_CROSS, + ENCTYPE_DES_CBC_NONE = ETYPE_DES_CBC_NONE, + ENCTYPE_DES3_CBC_NONE = ETYPE_DES3_CBC_NONE, + ENCTYPE_DES_CFB64_NONE = ETYPE_DES_CFB64_NONE, + ENCTYPE_DES_PCBC_NONE = ETYPE_DES_PCBC_NONE +}; + +typedef PADATA_TYPE krb5_preauthtype; + +typedef enum krb5_key_usage { + KRB5_KU_PA_ENC_TIMESTAMP = 1, + /* AS-REQ PA-ENC-TIMESTAMP padata timestamp, encrypted with the + client key (section 5.4.1) */ + KRB5_KU_TICKET = 2, + /* AS-REP Ticket and TGS-REP Ticket (includes tgs session key or + application session key), encrypted with the service key + (section 5.4.2) */ + KRB5_KU_AS_REP_ENC_PART = 3, + /* AS-REP encrypted part (includes tgs session key or application + session key), encrypted with the client key (section 5.4.2) */ + KRB5_KU_TGS_REQ_AUTH_DAT_SESSION = 4, + /* TGS-REQ KDC-REQ-BODY AuthorizationData, encrypted with the tgs + session key (section 5.4.1) */ + KRB5_KU_TGS_REQ_AUTH_DAT_SUBKEY = 5, + /* TGS-REQ KDC-REQ-BODY AuthorizationData, encrypted with the tgs + authenticator subkey (section 5.4.1) */ + KRB5_KU_TGS_REQ_AUTH_CKSUM = 6, + /* TGS-REQ PA-TGS-REQ padata AP-REQ Authenticator cksum, keyed + with the tgs session key (sections 5.3.2, 5.4.1) */ + KRB5_KU_TGS_REQ_AUTH = 7, + /* TGS-REQ PA-TGS-REQ padata AP-REQ Authenticator (includes tgs + authenticator subkey), encrypted with the tgs session key + (section 5.3.2) */ + KRB5_KU_TGS_REP_ENC_PART_SESSION = 8, + /* TGS-REP encrypted part (includes application session key), + encrypted with the tgs session key (section 5.4.2) */ + KRB5_KU_TGS_REP_ENC_PART_SUB_KEY = 9, + /* TGS-REP encrypted part (includes application session key), + encrypted with the tgs authenticator subkey (section 5.4.2) */ + KRB5_KU_AP_REQ_AUTH_CKSUM = 10, + /* AP-REQ Authenticator cksum, keyed with the application session + key (section 5.3.2) */ + KRB5_KU_AP_REQ_AUTH = 11, + /* AP-REQ Authenticator (includes application authenticator + subkey), encrypted with the application session key (section + 5.3.2) */ + KRB5_KU_AP_REQ_ENC_PART = 12, + /* AP-REP encrypted part (includes application session subkey), + encrypted with the application session key (section 5.5.2) */ + KRB5_KU_KRB_PRIV = 13, + /* KRB-PRIV encrypted part, encrypted with a key chosen by the + application (section 5.7.1) */ + KRB5_KU_KRB_CRED = 14, + /* KRB-CRED encrypted part, encrypted with a key chosen by the + application (section 5.8.1) */ + KRB5_KU_KRB_SAFE_CKSUM = 15, + /* KRB-SAFE cksum, keyed with a key chosen by the application + (section 5.6.1) */ + KRB5_KU_OTHER_ENCRYPTED = 16, + /* Data which is defined in some specification outside of + Kerberos to be encrypted using an RFC1510 encryption type. */ + KRB5_KU_OTHER_CKSUM = 17, + /* Data which is defined in some specification outside of + Kerberos to be checksummed using an RFC1510 checksum type. */ + KRB5_KU_KRB_ERROR = 18, + /* Krb-error checksum */ + KRB5_KU_AD_KDC_ISSUED = 19, + /* AD-KDCIssued checksum */ + KRB5_KU_MANDATORY_TICKET_EXTENSION = 20, + /* Checksum for Mandatory Ticket Extensions */ + KRB5_KU_AUTH_DATA_TICKET_EXTENSION = 21, + /* Checksum in Authorization Data in Ticket Extensions */ + KRB5_KU_USAGE_SEAL = 22, + /* seal in GSSAPI krb5 mechanism */ + KRB5_KU_USAGE_SIGN = 23, + /* sign in GSSAPI krb5 mechanism */ + KRB5_KU_USAGE_SEQ = 24 + /* SEQ in GSSAPI krb5 mechanism */ +} krb5_key_usage; + +typedef krb5_key_usage krb5_keyusage; + +typedef enum krb5_salttype { + KRB5_PW_SALT = KRB5_PADATA_PW_SALT, + KRB5_AFS3_SALT = KRB5_PADATA_AFS3_SALT +}krb5_salttype; + +typedef struct krb5_salt { + krb5_salttype salttype; + krb5_data saltvalue; +} krb5_salt; + +typedef ETYPE_INFO krb5_preauthinfo; + +typedef struct { + krb5_preauthtype type; + krb5_preauthinfo info; /* list of preauthinfo for this type */ +} krb5_preauthdata_entry; + +typedef struct krb5_preauthdata { + unsigned len; + krb5_preauthdata_entry *val; +}krb5_preauthdata; + +typedef enum krb5_address_type { + KRB5_ADDRESS_INET = 2, + KRB5_ADDRESS_INET6 = 24, + KRB5_ADDRESS_ADDRPORT = 256, + KRB5_ADDRESS_IPPORT = 257 +} krb5_address_type; + +enum { + AP_OPTS_USE_SESSION_KEY = 1, + AP_OPTS_MUTUAL_REQUIRED = 2, + AP_OPTS_USE_SUBKEY = 4 /* library internal */ +}; + +typedef HostAddress krb5_address; + +typedef HostAddresses krb5_addresses; + +typedef enum krb5_keytype { + KEYTYPE_NULL = 0, + KEYTYPE_DES = 1, + KEYTYPE_DES3 = 7, + KEYTYPE_AES128 = 17, + KEYTYPE_AES256 = 18, + KEYTYPE_ARCFOUR = 23, + KEYTYPE_ARCFOUR_56 = 24 +} krb5_keytype; + +typedef EncryptionKey krb5_keyblock; + +typedef AP_REQ krb5_ap_req; + +struct krb5_cc_ops; + +#define KRB5_DEFAULT_CCFILE_ROOT "/tmp/krb5cc_" + +#define KRB5_DEFAULT_CCROOT "FILE:" KRB5_DEFAULT_CCFILE_ROOT + +#define KRB5_ACCEPT_NULL_ADDRESSES(C) \ + krb5_config_get_bool_default((C), NULL, TRUE, \ + "libdefaults", "accept_null_addresses", \ + NULL) + +typedef void *krb5_cc_cursor; + +typedef struct krb5_ccache_data { + const struct krb5_cc_ops *ops; + krb5_data data; +}krb5_ccache_data; + +typedef struct krb5_ccache_data *krb5_ccache; + +typedef struct krb5_context_data *krb5_context; + +typedef Realm krb5_realm; +typedef const char *krb5_const_realm; /* stupid language */ + +#define krb5_realm_length(r) strlen(r) +#define krb5_realm_data(r) (r) + +typedef Principal krb5_principal_data; +typedef struct Principal *krb5_principal; +typedef const struct Principal *krb5_const_principal; + +typedef time_t krb5_deltat; +typedef time_t krb5_timestamp; + +typedef struct krb5_times { + krb5_timestamp authtime; + krb5_timestamp starttime; + krb5_timestamp endtime; + krb5_timestamp renew_till; +} krb5_times; + +typedef union { + TicketFlags b; + krb5_flags i; +} krb5_ticket_flags; + +/* options for krb5_get_in_tkt() */ +#define KDC_OPT_FORWARDABLE (1 << 1) +#define KDC_OPT_FORWARDED (1 << 2) +#define KDC_OPT_PROXIABLE (1 << 3) +#define KDC_OPT_PROXY (1 << 4) +#define KDC_OPT_ALLOW_POSTDATE (1 << 5) +#define KDC_OPT_POSTDATED (1 << 6) +#define KDC_OPT_RENEWABLE (1 << 8) +#define KDC_OPT_REQUEST_ANONYMOUS (1 << 14) +#define KDC_OPT_DISABLE_TRANSITED_CHECK (1 << 26) +#define KDC_OPT_RENEWABLE_OK (1 << 27) +#define KDC_OPT_ENC_TKT_IN_SKEY (1 << 28) +#define KDC_OPT_RENEW (1 << 30) +#define KDC_OPT_VALIDATE (1 << 31) + +typedef union { + KDCOptions b; + krb5_flags i; +} krb5_kdc_flags; + +/* flags for krb5_verify_ap_req */ + +#define KRB5_VERIFY_AP_REQ_IGNORE_INVALID (1 << 0) + +#define KRB5_GC_CACHED (1U << 0) +#define KRB5_GC_USER_USER (1U << 1) + +/* constants for compare_creds (and cc_retrieve_cred) */ +#define KRB5_TC_DONT_MATCH_REALM (1U << 31) +#define KRB5_TC_MATCH_KEYTYPE (1U << 30) + +typedef AuthorizationData krb5_authdata; + +typedef KRB_ERROR krb5_error; + +typedef struct krb5_creds { + krb5_principal client; + krb5_principal server; + krb5_keyblock session; + krb5_times times; + krb5_data ticket; + krb5_data second_ticket; + krb5_authdata authdata; + krb5_addresses addresses; + krb5_ticket_flags flags; +} krb5_creds; + +typedef struct krb5_cc_ops { + const char *prefix; + const char* (*get_name)(krb5_context, krb5_ccache); + krb5_error_code (*resolve)(krb5_context, krb5_ccache *, const char *); + krb5_error_code (*gen_new)(krb5_context, krb5_ccache *); + krb5_error_code (*init)(krb5_context, krb5_ccache, krb5_principal); + krb5_error_code (*destroy)(krb5_context, krb5_ccache); + krb5_error_code (*close)(krb5_context, krb5_ccache); + krb5_error_code (*store)(krb5_context, krb5_ccache, krb5_creds*); + krb5_error_code (*retrieve)(krb5_context, krb5_ccache, + krb5_flags, krb5_creds*, krb5_creds); + krb5_error_code (*get_princ)(krb5_context, krb5_ccache, krb5_principal*); + krb5_error_code (*get_first)(krb5_context, krb5_ccache, krb5_cc_cursor *); + krb5_error_code (*get_next)(krb5_context, krb5_ccache, + krb5_cc_cursor*, krb5_creds*); + krb5_error_code (*end_get)(krb5_context, krb5_ccache, krb5_cc_cursor*); + krb5_error_code (*remove_cred)(krb5_context, krb5_ccache, + krb5_flags, krb5_creds*); + krb5_error_code (*set_flags)(krb5_context, krb5_ccache, krb5_flags); + int (*get_version)(krb5_context, krb5_ccache); +} krb5_cc_ops; + +struct krb5_log_facility; + +struct krb5_config_binding { + enum { krb5_config_string, krb5_config_list } type; + char *name; + struct krb5_config_binding *next; + union { + char *string; + struct krb5_config_binding *list; + void *generic; + } u; +}; + +typedef struct krb5_config_binding krb5_config_binding; + +typedef krb5_config_binding krb5_config_section; + +typedef struct krb5_context_data { + krb5_enctype *etypes; + krb5_enctype *etypes_des; + char **default_realms; + time_t max_skew; + time_t kdc_timeout; + unsigned max_retries; + int32_t kdc_sec_offset; + int32_t kdc_usec_offset; + krb5_config_section *cf; + struct et_list *et_list; + struct krb5_log_facility *warn_dest; + krb5_cc_ops *cc_ops; + int num_cc_ops; + const char *http_proxy; + const char *time_fmt; + krb5_boolean log_utc; + const char *default_keytab; + const char *default_keytab_modify; + krb5_boolean use_admin_kdc; + krb5_addresses *extra_addresses; + krb5_boolean scan_interfaces; /* `ifconfig -a' */ + krb5_boolean srv_lookup; /* do SRV lookups */ + krb5_boolean srv_try_txt; /* try TXT records also */ + int32_t fcache_vno; /* create cache files w/ this + version */ + int num_kt_types; /* # of registered keytab types */ + struct krb5_keytab_data *kt_types; /* registered keytab types */ + const char *date_fmt; + char *error_string; + char error_buf[256]; + krb5_addresses *ignore_addresses; + char *default_cc_name; +} krb5_context_data; + +typedef struct krb5_ticket { + EncTicketPart ticket; + krb5_principal client; + krb5_principal server; +} krb5_ticket; + +typedef Authenticator krb5_authenticator_data; + +typedef krb5_authenticator_data *krb5_authenticator; + +struct krb5_rcache_data; +typedef struct krb5_rcache_data *krb5_rcache; +typedef Authenticator krb5_donot_replay; + +#define KRB5_STORAGE_HOST_BYTEORDER 0x01 /* old */ +#define KRB5_STORAGE_PRINCIPAL_WRONG_NUM_COMPONENTS 0x02 +#define KRB5_STORAGE_PRINCIPAL_NO_NAME_TYPE 0x04 +#define KRB5_STORAGE_KEYBLOCK_KEYTYPE_TWICE 0x08 +#define KRB5_STORAGE_BYTEORDER_MASK 0x60 +#define KRB5_STORAGE_BYTEORDER_BE 0x00 /* default */ +#define KRB5_STORAGE_BYTEORDER_LE 0x20 +#define KRB5_STORAGE_BYTEORDER_HOST 0x40 + +struct krb5_storage_data; +typedef struct krb5_storage_data krb5_storage; + +typedef struct krb5_keytab_entry { + krb5_principal principal; + krb5_kvno vno; + krb5_keyblock keyblock; + u_int32_t timestamp; +} krb5_keytab_entry; + +typedef struct krb5_kt_cursor { + int fd; + krb5_storage *sp; + void *data; +} krb5_kt_cursor; + +struct krb5_keytab_data; + +typedef struct krb5_keytab_data *krb5_keytab; + +#define KRB5_KT_PREFIX_MAX_LEN 30 + +struct krb5_keytab_data { + const char *prefix; + krb5_error_code (*resolve)(krb5_context, const char*, krb5_keytab); + krb5_error_code (*get_name)(krb5_context, krb5_keytab, char*, size_t); + krb5_error_code (*close)(krb5_context, krb5_keytab); + krb5_error_code (*get)(krb5_context, krb5_keytab, krb5_const_principal, + krb5_kvno, krb5_enctype, krb5_keytab_entry*); + krb5_error_code (*start_seq_get)(krb5_context, krb5_keytab, krb5_kt_cursor*); + krb5_error_code (*next_entry)(krb5_context, krb5_keytab, + krb5_keytab_entry*, krb5_kt_cursor*); + krb5_error_code (*end_seq_get)(krb5_context, krb5_keytab, krb5_kt_cursor*); + krb5_error_code (*add)(krb5_context, krb5_keytab, krb5_keytab_entry*); + krb5_error_code (*remove)(krb5_context, krb5_keytab, krb5_keytab_entry*); + void *data; + int32_t version; +}; + +typedef struct krb5_keytab_data krb5_kt_ops; + +struct krb5_keytab_key_proc_args { + krb5_keytab keytab; + krb5_principal principal; +}; + +typedef struct krb5_keytab_key_proc_args krb5_keytab_key_proc_args; + +typedef struct krb5_replay_data { + krb5_timestamp timestamp; + u_int32_t usec; + u_int32_t seq; +} krb5_replay_data; + +/* flags for krb5_auth_con_setflags */ +enum { + KRB5_AUTH_CONTEXT_DO_TIME = 1, + KRB5_AUTH_CONTEXT_RET_TIME = 2, + KRB5_AUTH_CONTEXT_DO_SEQUENCE = 4, + KRB5_AUTH_CONTEXT_RET_SEQUENCE = 8, + KRB5_AUTH_CONTEXT_PERMIT_ALL = 16 +}; + +/* flags for krb5_auth_con_genaddrs */ +enum { + KRB5_AUTH_CONTEXT_GENERATE_LOCAL_ADDR = 1, + KRB5_AUTH_CONTEXT_GENERATE_LOCAL_FULL_ADDR = 3, + KRB5_AUTH_CONTEXT_GENERATE_REMOTE_ADDR = 4, + KRB5_AUTH_CONTEXT_GENERATE_REMOTE_FULL_ADDR = 12 +}; + +typedef struct krb5_auth_context_data { + unsigned int flags; + + krb5_address *local_address; + krb5_address *remote_address; + int16_t local_port; + int16_t remote_port; + krb5_keyblock *keyblock; + krb5_keyblock *local_subkey; + krb5_keyblock *remote_subkey; + + u_int32_t local_seqnumber; + u_int32_t remote_seqnumber; + + krb5_authenticator authenticator; + + krb5_pointer i_vector; + + krb5_rcache rcache; + + krb5_keytype keytype; /* �requested key type ? */ + krb5_cksumtype cksumtype; /* �requested checksum type! */ + +}krb5_auth_context_data, *krb5_auth_context; + +typedef struct { + KDC_REP kdc_rep; + EncKDCRepPart enc_part; + KRB_ERROR error; +} krb5_kdc_rep; + +extern const char *heimdal_version, *heimdal_long_version; + +typedef void (*krb5_log_log_func_t)(const char*, const char*, void*); +typedef void (*krb5_log_close_func_t)(void*); + +typedef struct krb5_log_facility { + const char *program; + int len; + struct facility *val; +} krb5_log_facility; + +typedef EncAPRepPart krb5_ap_rep_enc_part; + +#define KRB5_RECVAUTH_IGNORE_VERSION 1 + +#define KRB5_SENDAUTH_VERSION "KRB5_SENDAUTH_V1.0" + +#define KRB5_TGS_NAME_SIZE (6) +#define KRB5_TGS_NAME ("krbtgt") + +/* variables */ + +extern const char *krb5_config_file; +extern const char *krb5_defkeyname; + +typedef enum { + KRB5_PROMPT_TYPE_PASSWORD = 0x1, + KRB5_PROMPT_TYPE_NEW_PASSWORD = 0x2, + KRB5_PROMPT_TYPE_NEW_PASSWORD_AGAIN = 0x3, + KRB5_PROMPT_TYPE_PREAUTH = 0x4 +} krb5_prompt_type; + +typedef struct _krb5_prompt { + const char *prompt; + int hidden; + krb5_data *reply; + krb5_prompt_type type; +} krb5_prompt; + +typedef int (*krb5_prompter_fct)(krb5_context context, + void *data, + const char *name, + const char *banner, + int num_prompts, + krb5_prompt prompts[]); + +typedef krb5_error_code (*krb5_key_proc)(krb5_context context, + krb5_enctype type, + krb5_salt salt, + krb5_const_pointer keyseed, + krb5_keyblock **key); +typedef krb5_error_code (*krb5_decrypt_proc)(krb5_context context, + krb5_keyblock *key, + krb5_key_usage usage, + krb5_const_pointer decrypt_arg, + krb5_kdc_rep *dec_rep); + + +typedef struct _krb5_get_init_creds_opt { + krb5_flags flags; + krb5_deltat tkt_life; + krb5_deltat renew_life; + int forwardable; + int proxiable; + int anonymous; + krb5_enctype *etype_list; + int etype_list_length; + krb5_addresses *address_list; +#if 0 /* this is the MIT-way */ + krb5_address **address_list; +#endif + /* XXX the next three should not be used, as they may be + removed later */ + krb5_preauthtype *preauth_list; + int preauth_list_length; + krb5_data *salt; +} krb5_get_init_creds_opt; + +#define KRB5_GET_INIT_CREDS_OPT_TKT_LIFE 0x0001 +#define KRB5_GET_INIT_CREDS_OPT_RENEW_LIFE 0x0002 +#define KRB5_GET_INIT_CREDS_OPT_FORWARDABLE 0x0004 +#define KRB5_GET_INIT_CREDS_OPT_PROXIABLE 0x0008 +#define KRB5_GET_INIT_CREDS_OPT_ETYPE_LIST 0x0010 +#define KRB5_GET_INIT_CREDS_OPT_ADDRESS_LIST 0x0020 +#define KRB5_GET_INIT_CREDS_OPT_PREAUTH_LIST 0x0040 +#define KRB5_GET_INIT_CREDS_OPT_SALT 0x0080 +#define KRB5_GET_INIT_CREDS_OPT_ANONYMOUS 0x0100 + +typedef struct _krb5_verify_init_creds_opt { + krb5_flags flags; + int ap_req_nofail; +} krb5_verify_init_creds_opt; + +#define KRB5_VERIFY_INIT_CREDS_OPT_AP_REQ_NOFAIL 0x0001 + +typedef struct krb5_verify_opt { + unsigned int flags; + krb5_ccache ccache; + krb5_keytab keytab; + krb5_boolean secure; + const char *service; +} krb5_verify_opt; + +#define KRB5_VERIFY_LREALMS 1 +#define KRB5_VERIFY_NO_ADDRESSES 2 + +extern const krb5_cc_ops krb5_fcc_ops; +extern const krb5_cc_ops krb5_mcc_ops; + +extern const krb5_kt_ops krb5_fkt_ops; +extern const krb5_kt_ops krb5_mkt_ops; +extern const krb5_kt_ops krb5_akf_ops; +extern const krb5_kt_ops krb4_fkt_ops; +extern const krb5_kt_ops krb5_srvtab_fkt_ops; +extern const krb5_kt_ops krb5_any_ops; + +#define KRB5_KPASSWD_VERS_CHANGEPW 1 +#define KRB5_KPASSWD_VERS_SETPW 0xff80 + +#define KRB5_KPASSWD_SUCCESS 0 +#define KRB5_KPASSWD_MALFORMED 1 +#define KRB5_KPASSWD_HARDERROR 2 +#define KRB5_KPASSWD_AUTHERROR 3 +#define KRB5_KPASSWD_SOFTERROR 4 +#define KRB5_KPASSWD_ACCESSDENIED 5 +#define KRB5_KPASSWD_BAD_VERSION 6 +#define KRB5_KPASSWD_INITIAL_FLAG_NEEDED 7 + +#define KPASSWD_PORT 464 + +/* types for the new krbhst interface */ +struct krb5_krbhst_data; +typedef struct krb5_krbhst_data *krb5_krbhst_handle; + +#define KRB5_KRBHST_KDC 1 +#define KRB5_KRBHST_ADMIN 2 +#define KRB5_KRBHST_CHANGEPW 3 +#define KRB5_KRBHST_KRB524 4 + +typedef struct krb5_krbhst_info { + enum { KRB5_KRBHST_UDP, + KRB5_KRBHST_TCP, + KRB5_KRBHST_HTTP } proto; + unsigned short port; + unsigned short def_port; + struct addrinfo *ai; + struct krb5_krbhst_info *next; + char hostname[1]; /* has to come last */ +} krb5_krbhst_info; + + +struct credentials; /* this is to keep the compiler happy */ +struct getargs; +struct sockaddr; + +#include + +#endif /* __KRB5_H__ */ + diff --git a/src/include.new/krb5_asn1.h b/src/include.new/krb5_asn1.h new file mode 100644 index 0000000..400abb3 --- /dev/null +++ b/src/include.new/krb5_asn1.h @@ -0,0 +1,1301 @@ +/* Generated from /usr/src/kerberos5/lib/libasn1/../../../crypto/heimdal/lib/asn1/k5.asn1 */ +/* Do not edit */ + +#ifndef __krb5_asn1_h__ +#define __krb5_asn1_h__ + +#include +#include + +#ifndef __asn1_common_definitions__ +#define __asn1_common_definitions__ + +typedef struct octet_string { + size_t length; + void *data; +} octet_string; + +typedef char *general_string; + +typedef struct oid { + size_t length; + unsigned *components; +} oid; + +#define ASN1_MALLOC_ENCODE(T, B, BL, S, L, R) \ + do { \ + (BL) = length_##T((S)); \ + (B) = malloc((BL)); \ + if((B) == NULL) { \ + (R) = ENOMEM; \ + } else { \ + (R) = encode_##T(((unsigned char*)(B)) + (BL) - 1, (BL), \ + (S), (L)); \ + if((R) != 0) { \ + free((B)); \ + (B) = NULL; \ + } \ + } \ + } while (0) + +#endif + +/* +NAME-TYPE ::= INTEGER +*/ + +typedef enum NAME_TYPE { + KRB5_NT_UNKNOWN = 0, + KRB5_NT_PRINCIPAL = 1, + KRB5_NT_SRV_INST = 2, + KRB5_NT_SRV_HST = 3, + KRB5_NT_SRV_XHST = 4, + KRB5_NT_UID = 5, + KRB5_NT_X500_PRINCIPAL = 6 +} NAME_TYPE; + +int encode_NAME_TYPE(unsigned char *, size_t, const NAME_TYPE *, size_t *); +int decode_NAME_TYPE(const unsigned char *, size_t, NAME_TYPE *, size_t *); +void free_NAME_TYPE (NAME_TYPE *); +size_t length_NAME_TYPE(const NAME_TYPE *); +int copy_NAME_TYPE (const NAME_TYPE *, NAME_TYPE *); + + +/* +MESSAGE-TYPE ::= INTEGER +*/ + +typedef enum MESSAGE_TYPE { + krb_as_req = 10, + krb_as_rep = 11, + krb_tgs_req = 12, + krb_tgs_rep = 13, + krb_ap_req = 14, + krb_ap_rep = 15, + krb_safe = 20, + krb_priv = 21, + krb_cred = 22, + krb_error = 30 +} MESSAGE_TYPE; + +int encode_MESSAGE_TYPE(unsigned char *, size_t, const MESSAGE_TYPE *, size_t *); +int decode_MESSAGE_TYPE(const unsigned char *, size_t, MESSAGE_TYPE *, size_t *); +void free_MESSAGE_TYPE (MESSAGE_TYPE *); +size_t length_MESSAGE_TYPE(const MESSAGE_TYPE *); +int copy_MESSAGE_TYPE (const MESSAGE_TYPE *, MESSAGE_TYPE *); + + +/* +PADATA-TYPE ::= INTEGER +*/ + +typedef enum PADATA_TYPE { + KRB5_PADATA_NONE = 0, + KRB5_PADATA_TGS_REQ = 1, + KRB5_PADATA_AP_REQ = 1, + KRB5_PADATA_ENC_TIMESTAMP = 2, + KRB5_PADATA_PW_SALT = 3, + KRB5_PADATA_ENC_UNIX_TIME = 5, + KRB5_PADATA_SANDIA_SECUREID = 6, + KRB5_PADATA_SESAME = 7, + KRB5_PADATA_OSF_DCE = 8, + KRB5_PADATA_CYBERSAFE_SECUREID = 9, + KRB5_PADATA_AFS3_SALT = 10, + KRB5_PADATA_ETYPE_INFO = 11, + KRB5_PADATA_SAM_CHALLENGE = 12, + KRB5_PADATA_SAM_RESPONSE = 13, + KRB5_PADATA_PK_AS_REQ = 14, + KRB5_PADATA_PK_AS_REP = 15, + KRB5_PADATA_PK_AS_SIGN = 16, + KRB5_PADATA_PK_KEY_REQ = 17, + KRB5_PADATA_PK_KEY_REP = 18, + KRB5_PADATA_ETYPE_INFO2 = 19, + KRB5_PADATA_USE_SPECIFIED_KVNO = 20, + KRB5_PADATA_SAM_REDIRECT = 21, + KRB5_PADATA_GET_FROM_TYPED_DATA = 22, + KRB5_PADATA_SAM_ETYPE_INFO = 23 +} PADATA_TYPE; + +int encode_PADATA_TYPE(unsigned char *, size_t, const PADATA_TYPE *, size_t *); +int decode_PADATA_TYPE(const unsigned char *, size_t, PADATA_TYPE *, size_t *); +void free_PADATA_TYPE (PADATA_TYPE *); +size_t length_PADATA_TYPE(const PADATA_TYPE *); +int copy_PADATA_TYPE (const PADATA_TYPE *, PADATA_TYPE *); + + +/* +CKSUMTYPE ::= INTEGER +*/ + +typedef enum CKSUMTYPE { + CKSUMTYPE_NONE = 0, + CKSUMTYPE_CRC32 = 1, + CKSUMTYPE_RSA_MD4 = 2, + CKSUMTYPE_RSA_MD4_DES = 3, + CKSUMTYPE_DES_MAC = 4, + CKSUMTYPE_DES_MAC_K = 5, + CKSUMTYPE_RSA_MD4_DES_K = 6, + CKSUMTYPE_RSA_MD5 = 7, + CKSUMTYPE_RSA_MD5_DES = 8, + CKSUMTYPE_RSA_MD5_DES3 = 9, + CKSUMTYPE_HMAC_SHA1_96_AES_128 = 10, + CKSUMTYPE_HMAC_SHA1_96_AES_256 = 11, + CKSUMTYPE_HMAC_SHA1_DES3 = 12, + CKSUMTYPE_SHA1 = 1000, + CKSUMTYPE_GSSAPI = 32771, + CKSUMTYPE_HMAC_MD5 = -138, + CKSUMTYPE_HMAC_MD5_ENC = -1138 +} CKSUMTYPE; + +int encode_CKSUMTYPE(unsigned char *, size_t, const CKSUMTYPE *, size_t *); +int decode_CKSUMTYPE(const unsigned char *, size_t, CKSUMTYPE *, size_t *); +void free_CKSUMTYPE (CKSUMTYPE *); +size_t length_CKSUMTYPE(const CKSUMTYPE *); +int copy_CKSUMTYPE (const CKSUMTYPE *, CKSUMTYPE *); + + +/* +ENCTYPE ::= INTEGER +*/ + +typedef enum ENCTYPE { + ETYPE_NULL = 0, + ETYPE_DES_CBC_CRC = 1, + ETYPE_DES_CBC_MD4 = 2, + ETYPE_DES_CBC_MD5 = 3, + ETYPE_DES3_CBC_MD5 = 5, + ETYPE_OLD_DES3_CBC_SHA1 = 7, + ETYPE_SIGN_DSA_GENERATE = 8, + ETYPE_ENCRYPT_RSA_PRIV = 9, + ETYPE_ENCRYPT_RSA_PUB = 10, + ETYPE_DES3_CBC_SHA1 = 16, + ETYPE_AES128_CTS_HMAC_SHA1_96 = 17, + ETYPE_AES256_CTS_HMAC_SHA1_96 = 18, + ETYPE_ARCFOUR_HMAC_MD5 = 23, + ETYPE_ARCFOUR_HMAC_MD5_56 = 24, + ETYPE_ENCTYPE_PK_CROSS = 48, + ETYPE_DES_CBC_NONE = -4096, + ETYPE_DES3_CBC_NONE = -4097, + ETYPE_DES_CFB64_NONE = -4098, + ETYPE_DES_PCBC_NONE = -4099 +} ENCTYPE; + +int encode_ENCTYPE(unsigned char *, size_t, const ENCTYPE *, size_t *); +int decode_ENCTYPE(const unsigned char *, size_t, ENCTYPE *, size_t *); +void free_ENCTYPE (ENCTYPE *); +size_t length_ENCTYPE(const ENCTYPE *); +int copy_ENCTYPE (const ENCTYPE *, ENCTYPE *); + + +/* +UNSIGNED ::= UNSIGNED INTEGER +*/ + +typedef unsigned int UNSIGNED; + +int encode_UNSIGNED(unsigned char *, size_t, const UNSIGNED *, size_t *); +int decode_UNSIGNED(const unsigned char *, size_t, UNSIGNED *, size_t *); +void free_UNSIGNED (UNSIGNED *); +size_t length_UNSIGNED(const UNSIGNED *); +int copy_UNSIGNED (const UNSIGNED *, UNSIGNED *); + + +/* +Realm ::= GeneralString +*/ + +typedef general_string Realm; + +int encode_Realm(unsigned char *, size_t, const Realm *, size_t *); +int decode_Realm(const unsigned char *, size_t, Realm *, size_t *); +void free_Realm (Realm *); +size_t length_Realm(const Realm *); +int copy_Realm (const Realm *, Realm *); + + +/* +PrincipalName ::= SEQUENCE { + name-type[0] NAME-TYPE, + name-string[1] SEQUENCE OF GeneralString +} +*/ + +typedef struct PrincipalName { + NAME_TYPE name_type; + struct { + unsigned int len; + general_string *val; + } name_string; +} PrincipalName; + +int encode_PrincipalName(unsigned char *, size_t, const PrincipalName *, size_t *); +int decode_PrincipalName(const unsigned char *, size_t, PrincipalName *, size_t *); +void free_PrincipalName (PrincipalName *); +size_t length_PrincipalName(const PrincipalName *); +int copy_PrincipalName (const PrincipalName *, PrincipalName *); + + +/* +Principal ::= SEQUENCE { + name[0] PrincipalName, + realm[1] Realm +} +*/ + +typedef struct Principal { + PrincipalName name; + Realm realm; +} Principal; + +int encode_Principal(unsigned char *, size_t, const Principal *, size_t *); +int decode_Principal(const unsigned char *, size_t, Principal *, size_t *); +void free_Principal (Principal *); +size_t length_Principal(const Principal *); +int copy_Principal (const Principal *, Principal *); + + +/* +HostAddress ::= SEQUENCE { + addr-type[0] INTEGER, + address[1] OCTET STRING +} +*/ + +typedef struct HostAddress { + int addr_type; + octet_string address; +} HostAddress; + +int encode_HostAddress(unsigned char *, size_t, const HostAddress *, size_t *); +int decode_HostAddress(const unsigned char *, size_t, HostAddress *, size_t *); +void free_HostAddress (HostAddress *); +size_t length_HostAddress(const HostAddress *); +int copy_HostAddress (const HostAddress *, HostAddress *); + + +/* +HostAddresses ::= SEQUENCE OF HostAddress +*/ + +typedef struct HostAddresses { + unsigned int len; + HostAddress *val; +} HostAddresses; + +int encode_HostAddresses(unsigned char *, size_t, const HostAddresses *, size_t *); +int decode_HostAddresses(const unsigned char *, size_t, HostAddresses *, size_t *); +void free_HostAddresses (HostAddresses *); +size_t length_HostAddresses(const HostAddresses *); +int copy_HostAddresses (const HostAddresses *, HostAddresses *); + + +/* +KerberosTime ::= GeneralizedTime +*/ + +typedef time_t KerberosTime; + +int encode_KerberosTime(unsigned char *, size_t, const KerberosTime *, size_t *); +int decode_KerberosTime(const unsigned char *, size_t, KerberosTime *, size_t *); +void free_KerberosTime (KerberosTime *); +size_t length_KerberosTime(const KerberosTime *); +int copy_KerberosTime (const KerberosTime *, KerberosTime *); + + +/* +AuthorizationData ::= SEQUENCE OF SEQUENCE { + ad-type[0] INTEGER, + ad-data[1] OCTET STRING +} +*/ + +typedef struct AuthorizationData { + unsigned int len; + struct { + int ad_type; + octet_string ad_data; + } *val; +} AuthorizationData; + +int encode_AuthorizationData(unsigned char *, size_t, const AuthorizationData *, size_t *); +int decode_AuthorizationData(const unsigned char *, size_t, AuthorizationData *, size_t *); +void free_AuthorizationData (AuthorizationData *); +size_t length_AuthorizationData(const AuthorizationData *); +int copy_AuthorizationData (const AuthorizationData *, AuthorizationData *); + + +/* +APOptions ::= BIT STRING { + reserved(0), + use-session-key(1), + mutual-required(2) +} +*/ + +typedef struct APOptions { + unsigned int reserved:1; + unsigned int use_session_key:1; + unsigned int mutual_required:1; +} APOptions; + + +int encode_APOptions(unsigned char *, size_t, const APOptions *, size_t *); +int decode_APOptions(const unsigned char *, size_t, APOptions *, size_t *); +void free_APOptions (APOptions *); +size_t length_APOptions(const APOptions *); +int copy_APOptions (const APOptions *, APOptions *); +unsigned APOptions2int(APOptions); +APOptions int2APOptions(unsigned); +extern struct units APOptions_units[]; + +/* +TicketFlags ::= BIT STRING { + reserved(0), + forwardable(1), + forwarded(2), + proxiable(3), + proxy(4), + may-postdate(5), + postdated(6), + invalid(7), + renewable(8), + initial(9), + pre-authent(10), + hw-authent(11), + transited-policy-checked(12), + ok-as-delegate(13), + anonymous(14) +} +*/ + +typedef struct TicketFlags { + unsigned int reserved:1; + unsigned int forwardable:1; + unsigned int forwarded:1; + unsigned int proxiable:1; + unsigned int proxy:1; + unsigned int may_postdate:1; + unsigned int postdated:1; + unsigned int invalid:1; + unsigned int renewable:1; + unsigned int initial:1; + unsigned int pre_authent:1; + unsigned int hw_authent:1; + unsigned int transited_policy_checked:1; + unsigned int ok_as_delegate:1; + unsigned int anonymous:1; +} TicketFlags; + + +int encode_TicketFlags(unsigned char *, size_t, const TicketFlags *, size_t *); +int decode_TicketFlags(const unsigned char *, size_t, TicketFlags *, size_t *); +void free_TicketFlags (TicketFlags *); +size_t length_TicketFlags(const TicketFlags *); +int copy_TicketFlags (const TicketFlags *, TicketFlags *); +unsigned TicketFlags2int(TicketFlags); +TicketFlags int2TicketFlags(unsigned); +extern struct units TicketFlags_units[]; + +/* +KDCOptions ::= BIT STRING { + reserved(0), + forwardable(1), + forwarded(2), + proxiable(3), + proxy(4), + allow-postdate(5), + postdated(6), + unused7(7), + renewable(8), + unused9(9), + unused10(10), + unused11(11), + request-anonymous(14), + canonicalize(15), + disable-transited-check(26), + renewable-ok(27), + enc-tkt-in-skey(28), + renew(30), + validate(31) +} +*/ + +typedef struct KDCOptions { + unsigned int reserved:1; + unsigned int forwardable:1; + unsigned int forwarded:1; + unsigned int proxiable:1; + unsigned int proxy:1; + unsigned int allow_postdate:1; + unsigned int postdated:1; + unsigned int unused7:1; + unsigned int renewable:1; + unsigned int unused9:1; + unsigned int unused10:1; + unsigned int unused11:1; + unsigned int request_anonymous:1; + unsigned int canonicalize:1; + unsigned int disable_transited_check:1; + unsigned int renewable_ok:1; + unsigned int enc_tkt_in_skey:1; + unsigned int renew:1; + unsigned int validate:1; +} KDCOptions; + + +int encode_KDCOptions(unsigned char *, size_t, const KDCOptions *, size_t *); +int decode_KDCOptions(const unsigned char *, size_t, KDCOptions *, size_t *); +void free_KDCOptions (KDCOptions *); +size_t length_KDCOptions(const KDCOptions *); +int copy_KDCOptions (const KDCOptions *, KDCOptions *); +unsigned KDCOptions2int(KDCOptions); +KDCOptions int2KDCOptions(unsigned); +extern struct units KDCOptions_units[]; + +/* +LR-TYPE ::= INTEGER +*/ + +typedef enum LR_TYPE { + LR_NONE = 0, + LR_INITIAL_TGT = 1, + LR_INITIAL = 2, + LR_ISSUE_USE_TGT = 3, + LR_RENEWAL = 4, + LR_REQUEST = 5, + LR_PW_EXPTIME = 6, + LR_ACCT_EXPTIME = 7 +} LR_TYPE; + +int encode_LR_TYPE(unsigned char *, size_t, const LR_TYPE *, size_t *); +int decode_LR_TYPE(const unsigned char *, size_t, LR_TYPE *, size_t *); +void free_LR_TYPE (LR_TYPE *); +size_t length_LR_TYPE(const LR_TYPE *); +int copy_LR_TYPE (const LR_TYPE *, LR_TYPE *); + + +/* +LastReq ::= SEQUENCE OF SEQUENCE { + lr-type[0] LR-TYPE, + lr-value[1] KerberosTime +} +*/ + +typedef struct LastReq { + unsigned int len; + struct { + LR_TYPE lr_type; + KerberosTime lr_value; + } *val; +} LastReq; + +int encode_LastReq(unsigned char *, size_t, const LastReq *, size_t *); +int decode_LastReq(const unsigned char *, size_t, LastReq *, size_t *); +void free_LastReq (LastReq *); +size_t length_LastReq(const LastReq *); +int copy_LastReq (const LastReq *, LastReq *); + + +/* +EncryptedData ::= SEQUENCE { + etype[0] ENCTYPE, + kvno[1] INTEGER OPTIONAL, + cipher[2] OCTET STRING +} +*/ + +typedef struct EncryptedData { + ENCTYPE etype; + int *kvno; + octet_string cipher; +} EncryptedData; + +int encode_EncryptedData(unsigned char *, size_t, const EncryptedData *, size_t *); +int decode_EncryptedData(const unsigned char *, size_t, EncryptedData *, size_t *); +void free_EncryptedData (EncryptedData *); +size_t length_EncryptedData(const EncryptedData *); +int copy_EncryptedData (const EncryptedData *, EncryptedData *); + + +/* +EncryptionKey ::= SEQUENCE { + keytype[0] INTEGER, + keyvalue[1] OCTET STRING +} +*/ + +typedef struct EncryptionKey { + int keytype; + octet_string keyvalue; +} EncryptionKey; + +int encode_EncryptionKey(unsigned char *, size_t, const EncryptionKey *, size_t *); +int decode_EncryptionKey(const unsigned char *, size_t, EncryptionKey *, size_t *); +void free_EncryptionKey (EncryptionKey *); +size_t length_EncryptionKey(const EncryptionKey *); +int copy_EncryptionKey (const EncryptionKey *, EncryptionKey *); + + +/* +TransitedEncoding ::= SEQUENCE { + tr-type[0] INTEGER, + contents[1] OCTET STRING +} +*/ + +typedef struct TransitedEncoding { + int tr_type; + octet_string contents; +} TransitedEncoding; + +int encode_TransitedEncoding(unsigned char *, size_t, const TransitedEncoding *, size_t *); +int decode_TransitedEncoding(const unsigned char *, size_t, TransitedEncoding *, size_t *); +void free_TransitedEncoding (TransitedEncoding *); +size_t length_TransitedEncoding(const TransitedEncoding *); +int copy_TransitedEncoding (const TransitedEncoding *, TransitedEncoding *); + + +/* +Ticket ::= [APPLICATION 1] SEQUENCE { + tkt-vno[0] INTEGER, + realm[1] Realm, + sname[2] PrincipalName, + enc-part[3] EncryptedData +} +*/ + +typedef struct { + int tkt_vno; + Realm realm; + PrincipalName sname; + EncryptedData enc_part; +} Ticket; + +int encode_Ticket(unsigned char *, size_t, const Ticket *, size_t *); +int decode_Ticket(const unsigned char *, size_t, Ticket *, size_t *); +void free_Ticket (Ticket *); +size_t length_Ticket(const Ticket *); +int copy_Ticket (const Ticket *, Ticket *); + + +/* +EncTicketPart ::= [APPLICATION 3] SEQUENCE { + flags[0] TicketFlags, + key[1] EncryptionKey, + crealm[2] Realm, + cname[3] PrincipalName, + transited[4] TransitedEncoding, + authtime[5] KerberosTime, + starttime[6] KerberosTime OPTIONAL, + endtime[7] KerberosTime, + renew-till[8] KerberosTime OPTIONAL, + caddr[9] HostAddresses OPTIONAL, + authorization-data[10] AuthorizationData OPTIONAL +} +*/ + +typedef struct { + TicketFlags flags; + EncryptionKey key; + Realm crealm; + PrincipalName cname; + TransitedEncoding transited; + KerberosTime authtime; + KerberosTime *starttime; + KerberosTime endtime; + KerberosTime *renew_till; + HostAddresses *caddr; + AuthorizationData *authorization_data; +} EncTicketPart; + +int encode_EncTicketPart(unsigned char *, size_t, const EncTicketPart *, size_t *); +int decode_EncTicketPart(const unsigned char *, size_t, EncTicketPart *, size_t *); +void free_EncTicketPart (EncTicketPart *); +size_t length_EncTicketPart(const EncTicketPart *); +int copy_EncTicketPart (const EncTicketPart *, EncTicketPart *); + + +/* +Checksum ::= SEQUENCE { + cksumtype[0] CKSUMTYPE, + checksum[1] OCTET STRING +} +*/ + +typedef struct Checksum { + CKSUMTYPE cksumtype; + octet_string checksum; +} Checksum; + +int encode_Checksum(unsigned char *, size_t, const Checksum *, size_t *); +int decode_Checksum(const unsigned char *, size_t, Checksum *, size_t *); +void free_Checksum (Checksum *); +size_t length_Checksum(const Checksum *); +int copy_Checksum (const Checksum *, Checksum *); + + +/* +Authenticator ::= [APPLICATION 2] SEQUENCE { + authenticator-vno[0] INTEGER, + crealm[1] Realm, + cname[2] PrincipalName, + cksum[3] Checksum OPTIONAL, + cusec[4] INTEGER, + ctime[5] KerberosTime, + subkey[6] EncryptionKey OPTIONAL, + seq-number[7] UNSIGNED OPTIONAL, + authorization-data[8] AuthorizationData OPTIONAL +} +*/ + +typedef struct { + int authenticator_vno; + Realm crealm; + PrincipalName cname; + Checksum *cksum; + int cusec; + KerberosTime ctime; + EncryptionKey *subkey; + UNSIGNED *seq_number; + AuthorizationData *authorization_data; +} Authenticator; + +int encode_Authenticator(unsigned char *, size_t, const Authenticator *, size_t *); +int decode_Authenticator(const unsigned char *, size_t, Authenticator *, size_t *); +void free_Authenticator (Authenticator *); +size_t length_Authenticator(const Authenticator *); +int copy_Authenticator (const Authenticator *, Authenticator *); + + +/* +PA-DATA ::= SEQUENCE { + padata-type[1] PADATA-TYPE, + padata-value[2] OCTET STRING +} +*/ + +typedef struct PA_DATA { + PADATA_TYPE padata_type; + octet_string padata_value; +} PA_DATA; + +int encode_PA_DATA(unsigned char *, size_t, const PA_DATA *, size_t *); +int decode_PA_DATA(const unsigned char *, size_t, PA_DATA *, size_t *); +void free_PA_DATA (PA_DATA *); +size_t length_PA_DATA(const PA_DATA *); +int copy_PA_DATA (const PA_DATA *, PA_DATA *); + + +/* +ETYPE-INFO-ENTRY ::= SEQUENCE { + etype[0] ENCTYPE, + salt[1] OCTET STRING OPTIONAL, + salttype[2] INTEGER OPTIONAL +} +*/ + +typedef struct ETYPE_INFO_ENTRY { + ENCTYPE etype; + octet_string *salt; + int *salttype; +} ETYPE_INFO_ENTRY; + +int encode_ETYPE_INFO_ENTRY(unsigned char *, size_t, const ETYPE_INFO_ENTRY *, size_t *); +int decode_ETYPE_INFO_ENTRY(const unsigned char *, size_t, ETYPE_INFO_ENTRY *, size_t *); +void free_ETYPE_INFO_ENTRY (ETYPE_INFO_ENTRY *); +size_t length_ETYPE_INFO_ENTRY(const ETYPE_INFO_ENTRY *); +int copy_ETYPE_INFO_ENTRY (const ETYPE_INFO_ENTRY *, ETYPE_INFO_ENTRY *); + + +/* +ETYPE-INFO ::= SEQUENCE OF ETYPE-INFO-ENTRY +*/ + +typedef struct ETYPE_INFO { + unsigned int len; + ETYPE_INFO_ENTRY *val; +} ETYPE_INFO; + +int encode_ETYPE_INFO(unsigned char *, size_t, const ETYPE_INFO *, size_t *); +int decode_ETYPE_INFO(const unsigned char *, size_t, ETYPE_INFO *, size_t *); +void free_ETYPE_INFO (ETYPE_INFO *); +size_t length_ETYPE_INFO(const ETYPE_INFO *); +int copy_ETYPE_INFO (const ETYPE_INFO *, ETYPE_INFO *); + + +/* +METHOD-DATA ::= SEQUENCE OF PA-DATA +*/ + +typedef struct METHOD_DATA { + unsigned int len; + PA_DATA *val; +} METHOD_DATA; + +int encode_METHOD_DATA(unsigned char *, size_t, const METHOD_DATA *, size_t *); +int decode_METHOD_DATA(const unsigned char *, size_t, METHOD_DATA *, size_t *); +void free_METHOD_DATA (METHOD_DATA *); +size_t length_METHOD_DATA(const METHOD_DATA *); +int copy_METHOD_DATA (const METHOD_DATA *, METHOD_DATA *); + + +/* +KDC-REQ-BODY ::= SEQUENCE { + kdc-options[0] KDCOptions, + cname[1] PrincipalName OPTIONAL, + realm[2] Realm, + sname[3] PrincipalName OPTIONAL, + from[4] KerberosTime OPTIONAL, + till[5] KerberosTime OPTIONAL, + rtime[6] KerberosTime OPTIONAL, + nonce[7] INTEGER, + etype[8] SEQUENCE OF ENCTYPE, + addresses[9] HostAddresses OPTIONAL, + enc-authorization-data[10] EncryptedData OPTIONAL, + additional-tickets[11] SEQUENCE OF Ticket OPTIONAL +} +*/ + +typedef struct KDC_REQ_BODY { + KDCOptions kdc_options; + PrincipalName *cname; + Realm realm; + PrincipalName *sname; + KerberosTime *from; + KerberosTime *till; + KerberosTime *rtime; + int nonce; + struct { + unsigned int len; + ENCTYPE *val; + } etype; + HostAddresses *addresses; + EncryptedData *enc_authorization_data; + struct { + unsigned int len; + Ticket *val; + } *additional_tickets; +} KDC_REQ_BODY; + +int encode_KDC_REQ_BODY(unsigned char *, size_t, const KDC_REQ_BODY *, size_t *); +int decode_KDC_REQ_BODY(const unsigned char *, size_t, KDC_REQ_BODY *, size_t *); +void free_KDC_REQ_BODY (KDC_REQ_BODY *); +size_t length_KDC_REQ_BODY(const KDC_REQ_BODY *); +int copy_KDC_REQ_BODY (const KDC_REQ_BODY *, KDC_REQ_BODY *); + + +/* +KDC-REQ ::= SEQUENCE { + pvno[1] INTEGER, + msg-type[2] MESSAGE-TYPE, + padata[3] METHOD-DATA OPTIONAL, + req-body[4] KDC-REQ-BODY +} +*/ + +typedef struct KDC_REQ { + int pvno; + MESSAGE_TYPE msg_type; + METHOD_DATA *padata; + KDC_REQ_BODY req_body; +} KDC_REQ; + +int encode_KDC_REQ(unsigned char *, size_t, const KDC_REQ *, size_t *); +int decode_KDC_REQ(const unsigned char *, size_t, KDC_REQ *, size_t *); +void free_KDC_REQ (KDC_REQ *); +size_t length_KDC_REQ(const KDC_REQ *); +int copy_KDC_REQ (const KDC_REQ *, KDC_REQ *); + + +/* +AS-REQ ::= [APPLICATION 10] KDC-REQ +*/ + +typedef KDC_REQ AS_REQ; + +int encode_AS_REQ(unsigned char *, size_t, const AS_REQ *, size_t *); +int decode_AS_REQ(const unsigned char *, size_t, AS_REQ *, size_t *); +void free_AS_REQ (AS_REQ *); +size_t length_AS_REQ(const AS_REQ *); +int copy_AS_REQ (const AS_REQ *, AS_REQ *); + + +/* +TGS-REQ ::= [APPLICATION 12] KDC-REQ +*/ + +typedef KDC_REQ TGS_REQ; + +int encode_TGS_REQ(unsigned char *, size_t, const TGS_REQ *, size_t *); +int decode_TGS_REQ(const unsigned char *, size_t, TGS_REQ *, size_t *); +void free_TGS_REQ (TGS_REQ *); +size_t length_TGS_REQ(const TGS_REQ *); +int copy_TGS_REQ (const TGS_REQ *, TGS_REQ *); + + +/* +PA-ENC-TS-ENC ::= SEQUENCE { + patimestamp[0] KerberosTime, + pausec[1] INTEGER OPTIONAL +} +*/ + +typedef struct PA_ENC_TS_ENC { + KerberosTime patimestamp; + int *pausec; +} PA_ENC_TS_ENC; + +int encode_PA_ENC_TS_ENC(unsigned char *, size_t, const PA_ENC_TS_ENC *, size_t *); +int decode_PA_ENC_TS_ENC(const unsigned char *, size_t, PA_ENC_TS_ENC *, size_t *); +void free_PA_ENC_TS_ENC (PA_ENC_TS_ENC *); +size_t length_PA_ENC_TS_ENC(const PA_ENC_TS_ENC *); +int copy_PA_ENC_TS_ENC (const PA_ENC_TS_ENC *, PA_ENC_TS_ENC *); + + +/* +KDC-REP ::= SEQUENCE { + pvno[0] INTEGER, + msg-type[1] MESSAGE-TYPE, + padata[2] METHOD-DATA OPTIONAL, + crealm[3] Realm, + cname[4] PrincipalName, + ticket[5] Ticket, + enc-part[6] EncryptedData +} +*/ + +typedef struct KDC_REP { + int pvno; + MESSAGE_TYPE msg_type; + METHOD_DATA *padata; + Realm crealm; + PrincipalName cname; + Ticket ticket; + EncryptedData enc_part; +} KDC_REP; + +int encode_KDC_REP(unsigned char *, size_t, const KDC_REP *, size_t *); +int decode_KDC_REP(const unsigned char *, size_t, KDC_REP *, size_t *); +void free_KDC_REP (KDC_REP *); +size_t length_KDC_REP(const KDC_REP *); +int copy_KDC_REP (const KDC_REP *, KDC_REP *); + + +/* +AS-REP ::= [APPLICATION 11] KDC-REP +*/ + +typedef KDC_REP AS_REP; + +int encode_AS_REP(unsigned char *, size_t, const AS_REP *, size_t *); +int decode_AS_REP(const unsigned char *, size_t, AS_REP *, size_t *); +void free_AS_REP (AS_REP *); +size_t length_AS_REP(const AS_REP *); +int copy_AS_REP (const AS_REP *, AS_REP *); + + +/* +TGS-REP ::= [APPLICATION 13] KDC-REP +*/ + +typedef KDC_REP TGS_REP; + +int encode_TGS_REP(unsigned char *, size_t, const TGS_REP *, size_t *); +int decode_TGS_REP(const unsigned char *, size_t, TGS_REP *, size_t *); +void free_TGS_REP (TGS_REP *); +size_t length_TGS_REP(const TGS_REP *); +int copy_TGS_REP (const TGS_REP *, TGS_REP *); + + +/* +EncKDCRepPart ::= SEQUENCE { + key[0] EncryptionKey, + last-req[1] LastReq, + nonce[2] INTEGER, + key-expiration[3] KerberosTime OPTIONAL, + flags[4] TicketFlags, + authtime[5] KerberosTime, + starttime[6] KerberosTime OPTIONAL, + endtime[7] KerberosTime, + renew-till[8] KerberosTime OPTIONAL, + srealm[9] Realm, + sname[10] PrincipalName, + caddr[11] HostAddresses OPTIONAL +} +*/ + +typedef struct EncKDCRepPart { + EncryptionKey key; + LastReq last_req; + int nonce; + KerberosTime *key_expiration; + TicketFlags flags; + KerberosTime authtime; + KerberosTime *starttime; + KerberosTime endtime; + KerberosTime *renew_till; + Realm srealm; + PrincipalName sname; + HostAddresses *caddr; +} EncKDCRepPart; + +int encode_EncKDCRepPart(unsigned char *, size_t, const EncKDCRepPart *, size_t *); +int decode_EncKDCRepPart(const unsigned char *, size_t, EncKDCRepPart *, size_t *); +void free_EncKDCRepPart (EncKDCRepPart *); +size_t length_EncKDCRepPart(const EncKDCRepPart *); +int copy_EncKDCRepPart (const EncKDCRepPart *, EncKDCRepPart *); + + +/* +EncASRepPart ::= [APPLICATION 25] EncKDCRepPart +*/ + +typedef EncKDCRepPart EncASRepPart; + +int encode_EncASRepPart(unsigned char *, size_t, const EncASRepPart *, size_t *); +int decode_EncASRepPart(const unsigned char *, size_t, EncASRepPart *, size_t *); +void free_EncASRepPart (EncASRepPart *); +size_t length_EncASRepPart(const EncASRepPart *); +int copy_EncASRepPart (const EncASRepPart *, EncASRepPart *); + + +/* +EncTGSRepPart ::= [APPLICATION 26] EncKDCRepPart +*/ + +typedef EncKDCRepPart EncTGSRepPart; + +int encode_EncTGSRepPart(unsigned char *, size_t, const EncTGSRepPart *, size_t *); +int decode_EncTGSRepPart(const unsigned char *, size_t, EncTGSRepPart *, size_t *); +void free_EncTGSRepPart (EncTGSRepPart *); +size_t length_EncTGSRepPart(const EncTGSRepPart *); +int copy_EncTGSRepPart (const EncTGSRepPart *, EncTGSRepPart *); + + +/* +AP-REQ ::= [APPLICATION 14] SEQUENCE { + pvno[0] INTEGER, + msg-type[1] MESSAGE-TYPE, + ap-options[2] APOptions, + ticket[3] Ticket, + authenticator[4] EncryptedData +} +*/ + +typedef struct { + int pvno; + MESSAGE_TYPE msg_type; + APOptions ap_options; + Ticket ticket; + EncryptedData authenticator; +} AP_REQ; + +int encode_AP_REQ(unsigned char *, size_t, const AP_REQ *, size_t *); +int decode_AP_REQ(const unsigned char *, size_t, AP_REQ *, size_t *); +void free_AP_REQ (AP_REQ *); +size_t length_AP_REQ(const AP_REQ *); +int copy_AP_REQ (const AP_REQ *, AP_REQ *); + + +/* +AP-REP ::= [APPLICATION 15] SEQUENCE { + pvno[0] INTEGER, + msg-type[1] MESSAGE-TYPE, + enc-part[2] EncryptedData +} +*/ + +typedef struct { + int pvno; + MESSAGE_TYPE msg_type; + EncryptedData enc_part; +} AP_REP; + +int encode_AP_REP(unsigned char *, size_t, const AP_REP *, size_t *); +int decode_AP_REP(const unsigned char *, size_t, AP_REP *, size_t *); +void free_AP_REP (AP_REP *); +size_t length_AP_REP(const AP_REP *); +int copy_AP_REP (const AP_REP *, AP_REP *); + + +/* +EncAPRepPart ::= [APPLICATION 27] SEQUENCE { + ctime[0] KerberosTime, + cusec[1] INTEGER, + subkey[2] EncryptionKey OPTIONAL, + seq-number[3] UNSIGNED OPTIONAL +} +*/ + +typedef struct { + KerberosTime ctime; + int cusec; + EncryptionKey *subkey; + UNSIGNED *seq_number; +} EncAPRepPart; + +int encode_EncAPRepPart(unsigned char *, size_t, const EncAPRepPart *, size_t *); +int decode_EncAPRepPart(const unsigned char *, size_t, EncAPRepPart *, size_t *); +void free_EncAPRepPart (EncAPRepPart *); +size_t length_EncAPRepPart(const EncAPRepPart *); +int copy_EncAPRepPart (const EncAPRepPart *, EncAPRepPart *); + + +/* +KRB-SAFE-BODY ::= SEQUENCE { + user-data[0] OCTET STRING, + timestamp[1] KerberosTime OPTIONAL, + usec[2] INTEGER OPTIONAL, + seq-number[3] UNSIGNED OPTIONAL, + s-address[4] HostAddress OPTIONAL, + r-address[5] HostAddress OPTIONAL +} +*/ + +typedef struct KRB_SAFE_BODY { + octet_string user_data; + KerberosTime *timestamp; + int *usec; + UNSIGNED *seq_number; + HostAddress *s_address; + HostAddress *r_address; +} KRB_SAFE_BODY; + +int encode_KRB_SAFE_BODY(unsigned char *, size_t, const KRB_SAFE_BODY *, size_t *); +int decode_KRB_SAFE_BODY(const unsigned char *, size_t, KRB_SAFE_BODY *, size_t *); +void free_KRB_SAFE_BODY (KRB_SAFE_BODY *); +size_t length_KRB_SAFE_BODY(const KRB_SAFE_BODY *); +int copy_KRB_SAFE_BODY (const KRB_SAFE_BODY *, KRB_SAFE_BODY *); + + +/* +KRB-SAFE ::= [APPLICATION 20] SEQUENCE { + pvno[0] INTEGER, + msg-type[1] MESSAGE-TYPE, + safe-body[2] KRB-SAFE-BODY, + cksum[3] Checksum +} +*/ + +typedef struct { + int pvno; + MESSAGE_TYPE msg_type; + KRB_SAFE_BODY safe_body; + Checksum cksum; +} KRB_SAFE; + +int encode_KRB_SAFE(unsigned char *, size_t, const KRB_SAFE *, size_t *); +int decode_KRB_SAFE(const unsigned char *, size_t, KRB_SAFE *, size_t *); +void free_KRB_SAFE (KRB_SAFE *); +size_t length_KRB_SAFE(const KRB_SAFE *); +int copy_KRB_SAFE (const KRB_SAFE *, KRB_SAFE *); + + +/* +KRB-PRIV ::= [APPLICATION 21] SEQUENCE { + pvno[0] INTEGER, + msg-type[1] MESSAGE-TYPE, + enc-part[3] EncryptedData +} +*/ + +typedef struct { + int pvno; + MESSAGE_TYPE msg_type; + EncryptedData enc_part; +} KRB_PRIV; + +int encode_KRB_PRIV(unsigned char *, size_t, const KRB_PRIV *, size_t *); +int decode_KRB_PRIV(const unsigned char *, size_t, KRB_PRIV *, size_t *); +void free_KRB_PRIV (KRB_PRIV *); +size_t length_KRB_PRIV(const KRB_PRIV *); +int copy_KRB_PRIV (const KRB_PRIV *, KRB_PRIV *); + + +/* +EncKrbPrivPart ::= [APPLICATION 28] SEQUENCE { + user-data[0] OCTET STRING, + timestamp[1] KerberosTime OPTIONAL, + usec[2] INTEGER OPTIONAL, + seq-number[3] UNSIGNED OPTIONAL, + s-address[4] HostAddress OPTIONAL, + r-address[5] HostAddress OPTIONAL +} +*/ + +typedef struct { + octet_string user_data; + KerberosTime *timestamp; + int *usec; + UNSIGNED *seq_number; + HostAddress *s_address; + HostAddress *r_address; +} EncKrbPrivPart; + +int encode_EncKrbPrivPart(unsigned char *, size_t, const EncKrbPrivPart *, size_t *); +int decode_EncKrbPrivPart(const unsigned char *, size_t, EncKrbPrivPart *, size_t *); +void free_EncKrbPrivPart (EncKrbPrivPart *); +size_t length_EncKrbPrivPart(const EncKrbPrivPart *); +int copy_EncKrbPrivPart (const EncKrbPrivPart *, EncKrbPrivPart *); + + +/* +KRB-CRED ::= [APPLICATION 22] SEQUENCE { + pvno[0] INTEGER, + msg-type[1] MESSAGE-TYPE, + tickets[2] SEQUENCE OF Ticket, + enc-part[3] EncryptedData +} +*/ + +typedef struct { + int pvno; + MESSAGE_TYPE msg_type; + struct { + unsigned int len; + Ticket *val; + } tickets; + EncryptedData enc_part; +} KRB_CRED; + +int encode_KRB_CRED(unsigned char *, size_t, const KRB_CRED *, size_t *); +int decode_KRB_CRED(const unsigned char *, size_t, KRB_CRED *, size_t *); +void free_KRB_CRED (KRB_CRED *); +size_t length_KRB_CRED(const KRB_CRED *); +int copy_KRB_CRED (const KRB_CRED *, KRB_CRED *); + + +/* +KrbCredInfo ::= SEQUENCE { + key[0] EncryptionKey, + prealm[1] Realm OPTIONAL, + pname[2] PrincipalName OPTIONAL, + flags[3] TicketFlags OPTIONAL, + authtime[4] KerberosTime OPTIONAL, + starttime[5] KerberosTime OPTIONAL, + endtime[6] KerberosTime OPTIONAL, + renew-till[7] KerberosTime OPTIONAL, + srealm[8] Realm OPTIONAL, + sname[9] PrincipalName OPTIONAL, + caddr[10] HostAddresses OPTIONAL +} +*/ + +typedef struct KrbCredInfo { + EncryptionKey key; + Realm *prealm; + PrincipalName *pname; + TicketFlags *flags; + KerberosTime *authtime; + KerberosTime *starttime; + KerberosTime *endtime; + KerberosTime *renew_till; + Realm *srealm; + PrincipalName *sname; + HostAddresses *caddr; +} KrbCredInfo; + +int encode_KrbCredInfo(unsigned char *, size_t, const KrbCredInfo *, size_t *); +int decode_KrbCredInfo(const unsigned char *, size_t, KrbCredInfo *, size_t *); +void free_KrbCredInfo (KrbCredInfo *); +size_t length_KrbCredInfo(const KrbCredInfo *); +int copy_KrbCredInfo (const KrbCredInfo *, KrbCredInfo *); + + +/* +EncKrbCredPart ::= [APPLICATION 29] SEQUENCE { + ticket-info[0] SEQUENCE OF KrbCredInfo, + nonce[1] INTEGER OPTIONAL, + timestamp[2] KerberosTime OPTIONAL, + usec[3] INTEGER OPTIONAL, + s-address[4] HostAddress OPTIONAL, + r-address[5] HostAddress OPTIONAL +} +*/ + +typedef struct { + struct { + unsigned int len; + KrbCredInfo *val; + } ticket_info; + int *nonce; + KerberosTime *timestamp; + int *usec; + HostAddress *s_address; + HostAddress *r_address; +} EncKrbCredPart; + +int encode_EncKrbCredPart(unsigned char *, size_t, const EncKrbCredPart *, size_t *); +int decode_EncKrbCredPart(const unsigned char *, size_t, EncKrbCredPart *, size_t *); +void free_EncKrbCredPart (EncKrbCredPart *); +size_t length_EncKrbCredPart(const EncKrbCredPart *); +int copy_EncKrbCredPart (const EncKrbCredPart *, EncKrbCredPart *); + + +/* +KRB-ERROR ::= [APPLICATION 30] SEQUENCE { + pvno[0] INTEGER, + msg-type[1] MESSAGE-TYPE, + ctime[2] KerberosTime OPTIONAL, + cusec[3] INTEGER OPTIONAL, + stime[4] KerberosTime, + susec[5] INTEGER, + error-code[6] INTEGER, + crealm[7] Realm OPTIONAL, + cname[8] PrincipalName OPTIONAL, + realm[9] Realm, + sname[10] PrincipalName, + e-text[11] GeneralString OPTIONAL, + e-data[12] OCTET STRING OPTIONAL +} +*/ + +typedef struct { + int pvno; + MESSAGE_TYPE msg_type; + KerberosTime *ctime; + int *cusec; + KerberosTime stime; + int susec; + int error_code; + Realm *crealm; + PrincipalName *cname; + Realm realm; + PrincipalName sname; + general_string *e_text; + octet_string *e_data; +} KRB_ERROR; + +int encode_KRB_ERROR(unsigned char *, size_t, const KRB_ERROR *, size_t *); +int decode_KRB_ERROR(const unsigned char *, size_t, KRB_ERROR *, size_t *); +void free_KRB_ERROR (KRB_ERROR *); +size_t length_KRB_ERROR(const KRB_ERROR *); +int copy_KRB_ERROR (const KRB_ERROR *, KRB_ERROR *); + + +/* +ChangePasswdDataMS ::= SEQUENCE { + newpasswd[0] OCTET STRING, + targname[1] PrincipalName OPTIONAL, + targrealm[2] Realm OPTIONAL +} +*/ + +typedef struct ChangePasswdDataMS { + octet_string newpasswd; + PrincipalName *targname; + Realm *targrealm; +} ChangePasswdDataMS; + +int encode_ChangePasswdDataMS(unsigned char *, size_t, const ChangePasswdDataMS *, size_t *); +int decode_ChangePasswdDataMS(const unsigned char *, size_t, ChangePasswdDataMS *, size_t *); +void free_ChangePasswdDataMS (ChangePasswdDataMS *); +size_t length_ChangePasswdDataMS(const ChangePasswdDataMS *); +int copy_ChangePasswdDataMS (const ChangePasswdDataMS *, ChangePasswdDataMS *); + + +enum { pvno = 5 }; + +enum { DOMAIN_X500_COMPRESS = 1 }; + +#endif /* __krb5_asn1_h__ */ diff --git a/src/include.new/krb5_err.h b/src/include.new/krb5_err.h new file mode 100644 index 0000000..4c0f542 --- /dev/null +++ b/src/include.new/krb5_err.h @@ -0,0 +1,181 @@ +/* Generated from /usr/src/kerberos5/lib/libkrb5/../../../crypto/heimdal/lib/krb5/krb5_err.et */ +/* $Id$ */ + +#ifndef __krb5_err_h__ +#define __krb5_err_h__ + +struct et_list; + +void initialize_krb5_error_table_r(struct et_list **); + +void initialize_krb5_error_table(void); +#define init_krb5_err_tbl initialize_krb5_error_table + +typedef enum krb5_error_number{ + KRB5KDC_ERR_NONE = -1765328384, + KRB5KDC_ERR_NAME_EXP = -1765328383, + KRB5KDC_ERR_SERVICE_EXP = -1765328382, + KRB5KDC_ERR_BAD_PVNO = -1765328381, + KRB5KDC_ERR_C_OLD_MAST_KVNO = -1765328380, + KRB5KDC_ERR_S_OLD_MAST_KVNO = -1765328379, + KRB5KDC_ERR_C_PRINCIPAL_UNKNOWN = -1765328378, + KRB5KDC_ERR_S_PRINCIPAL_UNKNOWN = -1765328377, + KRB5KDC_ERR_PRINCIPAL_NOT_UNIQUE = -1765328376, + KRB5KDC_ERR_NULL_KEY = -1765328375, + KRB5KDC_ERR_CANNOT_POSTDATE = -1765328374, + KRB5KDC_ERR_NEVER_VALID = -1765328373, + KRB5KDC_ERR_POLICY = -1765328372, + KRB5KDC_ERR_BADOPTION = -1765328371, + KRB5KDC_ERR_ETYPE_NOSUPP = -1765328370, + KRB5KDC_ERR_SUMTYPE_NOSUPP = -1765328369, + KRB5KDC_ERR_PADATA_TYPE_NOSUPP = -1765328368, + KRB5KDC_ERR_TRTYPE_NOSUPP = -1765328367, + KRB5KDC_ERR_CLIENT_REVOKED = -1765328366, + KRB5KDC_ERR_SERVICE_REVOKED = -1765328365, + KRB5KDC_ERR_TGT_REVOKED = -1765328364, + KRB5KDC_ERR_CLIENT_NOTYET = -1765328363, + KRB5KDC_ERR_SERVICE_NOTYET = -1765328362, + KRB5KDC_ERR_KEY_EXPIRED = -1765328361, + KRB5KDC_ERR_PREAUTH_FAILED = -1765328360, + KRB5KDC_ERR_PREAUTH_REQUIRED = -1765328359, + KRB5KDC_ERR_SERVER_NOMATCH = -1765328358, + KRB5KRB_AP_ERR_BAD_INTEGRITY = -1765328353, + KRB5KRB_AP_ERR_TKT_EXPIRED = -1765328352, + KRB5KRB_AP_ERR_TKT_NYV = -1765328351, + KRB5KRB_AP_ERR_REPEAT = -1765328350, + KRB5KRB_AP_ERR_NOT_US = -1765328349, + KRB5KRB_AP_ERR_BADMATCH = -1765328348, + KRB5KRB_AP_ERR_SKEW = -1765328347, + KRB5KRB_AP_ERR_BADADDR = -1765328346, + KRB5KRB_AP_ERR_BADVERSION = -1765328345, + KRB5KRB_AP_ERR_MSG_TYPE = -1765328344, + KRB5KRB_AP_ERR_MODIFIED = -1765328343, + KRB5KRB_AP_ERR_BADORDER = -1765328342, + KRB5KRB_AP_ERR_ILL_CR_TKT = -1765328341, + KRB5KRB_AP_ERR_BADKEYVER = -1765328340, + KRB5KRB_AP_ERR_NOKEY = -1765328339, + KRB5KRB_AP_ERR_MUT_FAIL = -1765328338, + KRB5KRB_AP_ERR_BADDIRECTION = -1765328337, + KRB5KRB_AP_ERR_METHOD = -1765328336, + KRB5KRB_AP_ERR_BADSEQ = -1765328335, + KRB5KRB_AP_ERR_INAPP_CKSUM = -1765328334, + KRB5KRB_AP_PATH_NOT_ACCEPTED = -1765328333, + KRB5KRB_ERR_RESPONSE_TOO_BIG = -1765328332, + KRB5KRB_ERR_GENERIC = -1765328324, + KRB5KRB_ERR_FIELD_TOOLONG = -1765328323, + KDC_ERROR_CLIENT_NOT_TRUSTED = -1765328322, + KDC_ERROR_KDC_NOT_TRUSTED = -1765328321, + KDC_ERROR_INVALID_SIG = -1765328320, + KDC_ERROR_KEY_TOO_WEAK = -1765328319, + KDC_ERROR_CERTIFICATE_MISMATCH = -1765328318, + KRB5_AP_ERR_USER_TO_USER_REQUIRED = -1765328317, + KDC_ERROR_CANT_VERIFY_CERTIFICATE = -1765328316, + KDC_ERROR_INVALID_CERTIFICATE = -1765328315, + KDC_ERROR_REVOKED_CERTIFICATE = -1765328314, + KDC_ERROR_REVOCATION_STATUS_UNKNOWN = -1765328313, + KDC_ERROR_REVOCATION_STATUS_UNAVAILABLE = -1765328312, + KDC_ERROR_CLIENT_NAME_MISMATCH = -1765328311, + KDC_ERROR_KDC_NAME_MISMATCH = -1765328310, + KRB5_ERR_RCSID = -1765328256, + KRB5_LIBOS_BADLOCKFLAG = -1765328255, + KRB5_LIBOS_CANTREADPWD = -1765328254, + KRB5_LIBOS_BADPWDMATCH = -1765328253, + KRB5_LIBOS_PWDINTR = -1765328252, + KRB5_PARSE_ILLCHAR = -1765328251, + KRB5_PARSE_MALFORMED = -1765328250, + KRB5_CONFIG_CANTOPEN = -1765328249, + KRB5_CONFIG_BADFORMAT = -1765328248, + KRB5_CONFIG_NOTENUFSPACE = -1765328247, + KRB5_BADMSGTYPE = -1765328246, + KRB5_CC_BADNAME = -1765328245, + KRB5_CC_UNKNOWN_TYPE = -1765328244, + KRB5_CC_NOTFOUND = -1765328243, + KRB5_CC_END = -1765328242, + KRB5_NO_TKT_SUPPLIED = -1765328241, + KRB5KRB_AP_WRONG_PRINC = -1765328240, + KRB5KRB_AP_ERR_TKT_INVALID = -1765328239, + KRB5_PRINC_NOMATCH = -1765328238, + KRB5_KDCREP_MODIFIED = -1765328237, + KRB5_KDCREP_SKEW = -1765328236, + KRB5_IN_TKT_REALM_MISMATCH = -1765328235, + KRB5_PROG_ETYPE_NOSUPP = -1765328234, + KRB5_PROG_KEYTYPE_NOSUPP = -1765328233, + KRB5_WRONG_ETYPE = -1765328232, + KRB5_PROG_SUMTYPE_NOSUPP = -1765328231, + KRB5_REALM_UNKNOWN = -1765328230, + KRB5_SERVICE_UNKNOWN = -1765328229, + KRB5_KDC_UNREACH = -1765328228, + KRB5_NO_LOCALNAME = -1765328227, + KRB5_MUTUAL_FAILED = -1765328226, + KRB5_RC_TYPE_EXISTS = -1765328225, + KRB5_RC_MALLOC = -1765328224, + KRB5_RC_TYPE_NOTFOUND = -1765328223, + KRB5_RC_UNKNOWN = -1765328222, + KRB5_RC_REPLAY = -1765328221, + KRB5_RC_IO = -1765328220, + KRB5_RC_NOIO = -1765328219, + KRB5_RC_PARSE = -1765328218, + KRB5_RC_IO_EOF = -1765328217, + KRB5_RC_IO_MALLOC = -1765328216, + KRB5_RC_IO_PERM = -1765328215, + KRB5_RC_IO_IO = -1765328214, + KRB5_RC_IO_UNKNOWN = -1765328213, + KRB5_RC_IO_SPACE = -1765328212, + KRB5_TRANS_CANTOPEN = -1765328211, + KRB5_TRANS_BADFORMAT = -1765328210, + KRB5_LNAME_CANTOPEN = -1765328209, + KRB5_LNAME_NOTRANS = -1765328208, + KRB5_LNAME_BADFORMAT = -1765328207, + KRB5_CRYPTO_INTERNAL = -1765328206, + KRB5_KT_BADNAME = -1765328205, + KRB5_KT_UNKNOWN_TYPE = -1765328204, + KRB5_KT_NOTFOUND = -1765328203, + KRB5_KT_END = -1765328202, + KRB5_KT_NOWRITE = -1765328201, + KRB5_KT_IOERR = -1765328200, + KRB5_NO_TKT_IN_RLM = -1765328199, + KRB5DES_BAD_KEYPAR = -1765328198, + KRB5DES_WEAK_KEY = -1765328197, + KRB5_BAD_ENCTYPE = -1765328196, + KRB5_BAD_KEYSIZE = -1765328195, + KRB5_BAD_MSIZE = -1765328194, + KRB5_CC_TYPE_EXISTS = -1765328193, + KRB5_KT_TYPE_EXISTS = -1765328192, + KRB5_CC_IO = -1765328191, + KRB5_FCC_PERM = -1765328190, + KRB5_FCC_NOFILE = -1765328189, + KRB5_FCC_INTERNAL = -1765328188, + KRB5_CC_WRITE = -1765328187, + KRB5_CC_NOMEM = -1765328186, + KRB5_CC_FORMAT = -1765328185, + KRB5_INVALID_FLAGS = -1765328184, + KRB5_NO_2ND_TKT = -1765328183, + KRB5_NOCREDS_SUPPLIED = -1765328182, + KRB5_SENDAUTH_BADAUTHVERS = -1765328181, + KRB5_SENDAUTH_BADAPPLVERS = -1765328180, + KRB5_SENDAUTH_BADRESPONSE = -1765328179, + KRB5_SENDAUTH_REJECTED = -1765328178, + KRB5_PREAUTH_BAD_TYPE = -1765328177, + KRB5_PREAUTH_NO_KEY = -1765328176, + KRB5_PREAUTH_FAILED = -1765328175, + KRB5_RCACHE_BADVNO = -1765328174, + KRB5_CCACHE_BADVNO = -1765328173, + KRB5_KEYTAB_BADVNO = -1765328172, + KRB5_PROG_ATYPE_NOSUPP = -1765328171, + KRB5_RC_REQUIRED = -1765328170, + KRB5_ERR_BAD_HOSTNAME = -1765328169, + KRB5_ERR_HOST_REALM_UNKNOWN = -1765328168, + KRB5_SNAME_UNSUPP_NAMETYPE = -1765328167, + KRB5KRB_AP_ERR_V4_REPLY = -1765328166, + KRB5_REALM_CANT_RESOLVE = -1765328165, + KRB5_TKT_NOT_FORWARDABLE = -1765328164, + KRB5_FWD_BAD_PRINCIPAL = -1765328163, + KRB5_GET_IN_TKT_LOOP = -1765328162, + KRB5_CONFIG_NODEFREALM = -1765328161, + KRB5_SAM_UNSUPPORTED = -1765328160, + KRB5_KT_NAME_TOOLONG = -1765328159 +} krb5_error_number; + +#define ERROR_TABLE_BASE_krb5 -1765328384 + +#endif /* __krb5_err_h__ */ diff --git a/src/include.new/kvm.h b/src/include.new/kvm.h new file mode 100644 index 0000000..35aeff5 --- /dev/null +++ b/src/include.new/kvm.h @@ -0,0 +1,95 @@ +/*- + * Copyright (c) 1989, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)kvm.h 8.1 (Berkeley) 6/2/93 + * $FreeBSD: src/lib/libkvm/kvm.h,v 1.16 2003/10/13 04:44:55 bde Exp $ + */ + +#ifndef _KVM_H_ +#define _KVM_H_ + +#include +#include +#include + +/* Default version symbol. */ +#define VRS_SYM "_version" +#define VRS_KEY "VERSION" + +#ifndef _SIZE_T_DECLARED +typedef __size_t size_t; +#define _SIZE_T_DECLARED +#endif + +#ifndef _SSIZE_T_DECLARED +typedef __ssize_t ssize_t; +#define _SSIZE_T_DECLARED +#endif + +typedef struct __kvm kvm_t; + +struct kinfo_proc; +struct proc; + +struct kvm_swap { + char ksw_devname[32]; + int ksw_used; + int ksw_total; + int ksw_flags; + int ksw_reserved1; + int ksw_reserved2; +}; + +#define SWIF_DEV_PREFIX 0x0002 + +__BEGIN_DECLS +int kvm_close(kvm_t *); +char **kvm_getargv(kvm_t *, const struct kinfo_proc *, int); +char **kvm_getenvv(kvm_t *, const struct kinfo_proc *, int); +char *kvm_geterr(kvm_t *); +char *kvm_getfiles(kvm_t *, int, int, int *); +int kvm_getloadavg(kvm_t *, double [], int); +struct kinfo_proc * + kvm_getprocs(kvm_t *, int, int, int *); +int kvm_getswapinfo(kvm_t *, struct kvm_swap *, int, int); +int kvm_nlist(kvm_t *, struct nlist *); +kvm_t *kvm_open + (const char *, const char *, const char *, int, const char *); +kvm_t *kvm_openfiles + (const char *, const char *, const char *, int, char *); +ssize_t kvm_read(kvm_t *, unsigned long, void *, size_t); +ssize_t kvm_uread + (kvm_t *, struct kinfo_proc *, unsigned long, char *, size_t); +ssize_t kvm_write(kvm_t *, unsigned long, const void *, size_t); +__END_DECLS + +#endif /* !_KVM_H_ */ diff --git a/src/include.new/langinfo.h b/src/include.new/langinfo.h new file mode 100644 index 0000000..4a1375c --- /dev/null +++ b/src/include.new/langinfo.h @@ -0,0 +1,121 @@ +/*- + * Copyright (c) 2001 Alexey Zelkin + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD: src/include/langinfo.h,v 1.6 2002/09/18 05:54:25 mike Exp $ + */ + +#ifndef _LANGINFO_H_ +#define _LANGINFO_H_ + +#include +#include + +#ifndef _NL_ITEM_DECLARED +typedef __nl_item nl_item; +#define _NL_ITEM_DECLARED +#endif + +#define CODESET 0 /* codeset name */ +#define D_T_FMT 1 /* string for formatting date and time */ +#define D_FMT 2 /* date format string */ +#define T_FMT 3 /* time format string */ +#define T_FMT_AMPM 4 /* a.m. or p.m. time formatting string */ +#define AM_STR 5 /* Ante Meridian affix */ +#define PM_STR 6 /* Post Meridian affix */ + +/* week day names */ +#define DAY_1 7 +#define DAY_2 8 +#define DAY_3 9 +#define DAY_4 10 +#define DAY_5 11 +#define DAY_6 12 +#define DAY_7 13 + +/* abbreviated week day names */ +#define ABDAY_1 14 +#define ABDAY_2 15 +#define ABDAY_3 16 +#define ABDAY_4 17 +#define ABDAY_5 18 +#define ABDAY_6 19 +#define ABDAY_7 20 + +/* month names */ +#define MON_1 21 +#define MON_2 22 +#define MON_3 23 +#define MON_4 24 +#define MON_5 25 +#define MON_6 26 +#define MON_7 27 +#define MON_8 28 +#define MON_9 29 +#define MON_10 30 +#define MON_11 31 +#define MON_12 32 + +/* abbreviated month names */ +#define ABMON_1 33 +#define ABMON_2 34 +#define ABMON_3 35 +#define ABMON_4 36 +#define ABMON_5 37 +#define ABMON_6 38 +#define ABMON_7 39 +#define ABMON_8 40 +#define ABMON_9 41 +#define ABMON_10 42 +#define ABMON_11 43 +#define ABMON_12 44 + +#define ERA 45 /* era description segments */ +#define ERA_D_FMT 46 /* era date format string */ +#define ERA_D_T_FMT 47 /* era date and time format string */ +#define ERA_T_FMT 48 /* era time format string */ +#define ALT_DIGITS 49 /* alternative symbols for digits */ + +#define RADIXCHAR 50 /* radix char */ +#define THOUSEP 51 /* separator for thousands */ + +#define YESEXPR 52 /* affirmative response expression */ +#define NOEXPR 53 /* negative response expression */ + +#if __BSD_VISIBLE || __XSI_VISIBLE <= 500 +#define YESSTR 54 /* affirmative response for yes/no queries */ +#define NOSTR 55 /* negative response for yes/no queries */ +#endif + +#define CRNCYSTR 56 /* currency symbol */ + +#if __BSD_VISIBLE +#define D_MD_ORDER 57 /* month/day order (local extension) */ +#endif + +__BEGIN_DECLS +char *nl_langinfo(nl_item); +__END_DECLS + +#endif /* !_LANGINFO_H_ */ diff --git a/src/include.new/libatm.h b/src/include.new/libatm.h new file mode 100644 index 0000000..bbd7b5d --- /dev/null +++ b/src/include.new/libatm.h @@ -0,0 +1,117 @@ +/* + * + * =================================== + * HARP | Host ATM Research Platform + * =================================== + * + * + * This Host ATM Research Platform ("HARP") file (the "Software") is + * made available by Network Computing Services, Inc. ("NetworkCS") + * "AS IS". NetworkCS does not provide maintenance, improvements or + * support of any kind. + * + * NETWORKCS MAKES NO WARRANTIES OR REPRESENTATIONS, EXPRESS OR IMPLIED, + * INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE, AS TO ANY ELEMENT OF THE + * SOFTWARE OR ANY SUPPORT PROVIDED IN CONNECTION WITH THIS SOFTWARE. + * In no event shall NetworkCS be responsible for any damages, including + * but not limited to consequential damages, arising from or relating to + * any use of the Software or related support. + * + * Copyright 1994-1998 Network Computing Services, Inc. + * + * Copies of this Software may be made, however, the above copyright + * notice must be reproduced on all copies. + * + * @(#) $FreeBSD: src/lib/libatm/libatm.h,v 1.7 2003/07/29 13:35:03 harti Exp $ + * + */ + +/* + * User Space Library Functions + * ---------------------------- + * + * Library functions + * + */ + +#ifndef _HARP_LIBHARP_H +#define _HARP_LIBHARP_H + +/* + * Start a HARP user-space timer + * + * tp pointer to timer control block + * time number of seconds for timer to run + * fp pointer to function to call at expiration + */ +#define HARP_TIMER(tp, time, fp) \ +{ \ + (tp)->ht_ticks = (time); \ + (tp)->ht_mark = 0; \ + (tp)->ht_func = (fp); \ + LINK2HEAD((tp), Harp_timer, harp_timer_head, ht_next); \ +} + +/* + * Cancel a HARP user-space timer + * + * tp pointer to timer control block + */ +#define HARP_CANCEL(tp) \ +{ \ + UNLINK((tp), Harp_timer, harp_timer_head, ht_next); \ +} + + +/* + * HARP user-space timer control block + */ +struct harp_timer { + struct harp_timer *ht_next; /* Timer chain */ + int ht_ticks; /* Seconds till exp */ + int ht_mark; /* Processing flag */ + void (*ht_func)(struct harp_timer *); /* Function to call */ +}; +typedef struct harp_timer Harp_timer; + + +/* + * Externally-visible variables and functions + */ + +/* atm_addr.c */ +extern int get_hex_atm_addr(const char *, u_char *, int); +extern char *format_atm_addr(const Atm_addr *); + +/* cache_key.c */ +extern void scsp_cache_key(const Atm_addr *, + const struct in_addr *, int, char *); + +/* ioctl_subr.c */ +extern ssize_t do_info_ioctl(struct atminfreq *, size_t); +extern ssize_t get_vcc_info(const char *, struct air_vcc_rsp **); +extern int get_subnet_mask(const char *, struct sockaddr_in *); +extern int get_mtu(const char *); +extern int verify_nif_name(const char *); +extern ssize_t get_cfg_info(const char *, struct air_cfg_rsp **); +extern ssize_t get_intf_info(const char *, struct air_int_rsp **); +extern ssize_t get_netif_info(const char *, struct air_netif_rsp **); + +/* ip_addr.c */ +extern struct sockaddr_in *get_ip_addr(const char *); +extern const char *format_ip_addr(const struct in_addr *); + +/* ip_checksum.c */ +extern short ip_checksum(const char *, int); + +/* timer.c */ +extern Harp_timer *harp_timer_head; +extern int harp_timer_exec; +extern void timer_proc(void); +extern int init_timer(void); +extern int block_timer(void); +extern void enable_timer(int); + + +#endif /* _HARP_LIBHARP_H */ diff --git a/src/include.new/libdisk.h b/src/include.new/libdisk.h new file mode 100644 index 0000000..5c0734f --- /dev/null +++ b/src/include.new/libdisk.h @@ -0,0 +1,363 @@ +/* +* ---------------------------------------------------------------------------- +* "THE BEER-WARE LICENSE" (Revision 42): +* wrote this file. As long as you retain this notice you +* can do whatever you want with this stuff. If we meet some day, and you think +* this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp +* ---------------------------------------------------------------------------- +* +* $FreeBSD: src/lib/libdisk/libdisk.h,v 1.62 2004/04/21 23:21:13 grehan Exp $ +* +*/ + +/* #define DEBUG 1 */ +/* You can define a particular architecture here if you are debugging. */ +/* #define P_DEBUG p_sparc64 */ + +#define MAX_NO_DISKS 32 +/* Max # of disks Disk_Names() will return */ + +#define MAX_SEC_SIZE 2048 /* maximum sector size that is supported */ +#define MIN_SEC_SIZE 512 /* the sector size to end sensing at */ + +enum platform { + p_any, /* for debugging ! */ + p_alpha, + p_i386, + p_pc98, + p_sparc64, + p_ia64, + p_ppc, + p_amd64 +}; +extern const enum platform platform; + +typedef enum { + whole, + unknown, + + sun, + pc98, + mbr, + gpt, + + efi, + fat, + freebsd, + extended, + part, + spare, + unused, + + apple +} chunk_e; + +__BEGIN_DECLS +#ifndef __ia64__ +struct disk { + char *name; + u_long bios_cyl; + u_long bios_hd; + u_long bios_sect; +#ifdef PC98 + u_char *bootipl; + size_t bootipl_size; + u_char *bootmenu; + size_t bootmenu_size; +#else + u_char *bootmgr; + size_t bootmgr_size; +#endif + u_char *boot1; +#if defined(__i386__) || defined(__amd64__) /* the i386 needs extra help... */ + u_char *boot2; +#endif + struct chunk *chunks; + u_long sector_size; /* media sector size, a power of 2 */ +}; +#else /* !__ia64__ */ +struct disk { + char *name; + struct chunk *chunks; + u_long media_size; + u_long sector_size; + u_long lba_start; + u_long lba_end; + u_int gpt_size; /* Number of entries */ +}; +#endif + +struct chunk { + struct chunk *next; + struct chunk *part; + struct disk *disk; + daddr_t offset; + daddr_t size; + daddr_t end; + char *sname; /* PC98 field */ + char *name; + char *oname; + /* Used during Fixup_Names() to avoid renaming more than + * absolutely needed. + */ + chunk_e type; + int subtype; + u_long flags; + void (*private_free)(void*); + void *(*private_clone)(void*); + void *private_data; + /* For data private to the application, and the management + * thereof. If the functions are not provided, no storage + * management is done, Cloning will just copy the pointer + * and freeing will just forget it. + */ +}; + +/* + * flags: + * + * ALIGN - This chunk should be aligned + * IS_ROOT - This 'part' is a rootfs, allocate 'a' + * ACTIVE - This is the active slice in the MBR + * FORCE_ALL - Force a dedicated disk for FreeBSD, bypassing + * all BIOS geometry considerations + * AUTO_SIZE - This chunk was auto-sized and can fill-out a + * following chunk if the following chunk is deleted. + * NEWFS - newfs pending, used to enable auto-resizing on + * delete (along with AUTO_SIZE). + */ + +#define CHUNK_ALIGN 0x0008 +#define CHUNK_IS_ROOT 0x0010 +#define CHUNK_ACTIVE 0x0020 +#define CHUNK_FORCE_ALL 0x0040 +#define CHUNK_AUTO_SIZE 0x0080 +#define CHUNK_NEWFS 0x0100 +#define CHUNK_HAS_INDEX 0x0200 +#define CHUNK_ITOF(i) ((i & 0xFFFF) << 16) +#define CHUNK_FTOI(f) ((f >> 16) & 0xFFFF) + +#define DELCHUNK_NORMAL 0x0000 +#define DELCHUNK_RECOVER 0x0001 + +const char *chunk_name(chunk_e); + +const char * +slice_type_name(int, int); +/* "chunk_n" for subtypes too */ + +struct disk * +Open_Disk(const char *); +/* Will open the named disk, and return populated tree. */ + +void +Free_Disk(struct disk *); +/* Free a tree made with Open_Disk() or Clone_Disk() */ + +void +Debug_Disk(struct disk *); +/* Print the content of the tree to stdout */ + +void +Set_Bios_Geom(struct disk *, u_long, u_long, u_long); +/* Set the geometry the bios uses. */ + +void +Sanitize_Bios_Geom(struct disk *); +/* Set the bios geometry to something sane */ + +int +Insert_Chunk(struct chunk *, daddr_t, daddr_t, const char *, chunk_e, int, + u_long, const char *); + +int +Delete_Chunk2(struct disk *, struct chunk *, int); +/* Free a chunk of disk_space modified by the passed flags. */ + +int +Delete_Chunk(struct disk *, struct chunk *); +/* Free a chunk of disk_space */ + +void +Collapse_Disk(struct disk *); +/* Experimental, do not use. */ + +int +Collapse_Chunk(struct disk *, struct chunk *); +/* Experimental, do not use. */ + +int +Create_Chunk(struct disk *, daddr_t, daddr_t, chunk_e, int, u_long, const char *); +/* Create a chunk with the specified paramters */ + +void +All_FreeBSD(struct disk *, int); +/* + * Make one FreeBSD chunk covering the entire disk; + * if force_all is set, bypass all BIOS geometry + * considerations. + */ + +char * +CheckRules(const struct disk *); +/* Return char* to warnings about broken design rules in this disklayout */ + +char ** +Disk_Names(void); +/* + * Return char** with all disk's names (wd0, wd1 ...). You must free + * each pointer, as well as the array by hand + */ + +#ifdef PC98 +void +Set_Boot_Mgr(struct disk *, const u_char *, const size_t, const u_char *, + const size_t); +#else +void +Set_Boot_Mgr(struct disk *, const u_char *, const size_t); +#endif +/* + * Use this boot-manager on this disk. Gets written when Write_Disk() + * is called + */ + +int +Set_Boot_Blocks(struct disk *, const u_char *, const u_char *); +/* + * Use these boot-blocks on this disk. Gets written when Write_Disk() + * is called. Returns nonzero upon failure. + */ + +int +Write_Disk(const struct disk *); +/* Write all the MBRs, disklabels, bootblocks and boot managers */ + +daddr_t +Next_Cyl_Aligned(const struct disk *, daddr_t); +/* Round offset up to next cylinder according to the bios-geometry */ + +daddr_t +Prev_Cyl_Aligned(const struct disk *, daddr_t); +/* Round offset down to previous cylinder according to the bios-geometry */ + +int +Track_Aligned(const struct disk *, daddr_t); +/* Check if offset is aligned on a track according to the bios geometry */ + +daddr_t +Next_Track_Aligned(const struct disk *, daddr_t); +/* Round offset up to next track according to the bios-geometry */ + +daddr_t +Prev_Track_Aligned(const struct disk *, daddr_t); +/* Check if offset is aligned on a track according to the bios geometry */ + +struct chunk * +Create_Chunk_DWIM(struct disk *, struct chunk *, daddr_t, chunk_e, int, + u_long); +/* + * This one creates a partition inside the given parent of the given + * size, and returns a pointer to it. The first unused chunk big + * enough is used. + */ + +char * +ShowChunkFlags(struct chunk *); +/* Return string to show flags. */ + +/* + * Implementation details >>> DO NOT USE <<< + */ + +struct disklabel; + +void Fill_Disklabel(struct disklabel *, const struct disk *, + const struct chunk *); +void Debug_Chunk(struct chunk *); +struct chunk *New_Chunk(void); +void Free_Chunk(struct chunk *); +struct chunk *Clone_Chunk(const struct chunk *); +int Add_Chunk(struct disk *, daddr_t, daddr_t, const char *, chunk_e, int, + u_long, const char *); +void *read_block(int, daddr_t, u_long); +int write_block(int, daddr_t, const void *, u_long); +struct disklabel *read_disklabel(int, daddr_t, u_long); +struct disk *Int_Open_Disk(const char *, char *); +int Fixup_Names(struct disk *); +int MakeDevChunk(const struct chunk *, const char *); +__END_DECLS + +#define dprintf printf + +/* TODO + * + * Need an error string mechanism from the functions instead of warn() + * + * Make sure only FreeBSD start at offset==0 + * + * Collapse must align. + * + * Make Write_Disk(struct disk*) + * + * Consider booting from OnTrack'ed disks. + * + * Get Bios-geom, ST506 & OnTrack from driver (or otherwise) + * + * Make Create_DWIM(). + * + * Make Is_Unchanged(struct disk *d1, struct chunk *c1) + * + * don't rename slices unless we have to + * + *Sample output from tst01: + * + * Debug_Disk(wd0) flags=0 bios_geom=0/0/0 + * >> 0x3d040 0 1411200 1411199 wd0 0 whole 0 0 + * >>>> 0x3d080 0 960120 960119 wd0s1 3 freebsd 0 8 + * >>>>>> 0x3d100 0 40960 40959 wd0s1a 5 part 0 0 + * >>>>>> 0x3d180 40960 131072 172031 wd0s1b 5 part 0 0 + * >>>>>> 0x3d1c0 172032 409600 581631 wd0s1e 5 part 0 0 + * >>>>>> 0x3d200 581632 378488 960119 wd0s1f 5 part 0 0 + * >>>> 0x3d140 960120 5670 965789 wd0s2 4 extended 0 8 + * >>>>>> 0x3d2c0 960120 63 960182 - 6 unused 0 0 + * >>>>>> 0x3d0c0 960183 5607 965789 wd0s5 2 fat 0 8 + * >>>> 0x3d280 965790 1890 967679 wd0s3 1 foo -2 8 + * >>>> 0x3d300 967680 443520 1411199 wd0s4 3 freebsd 0 8 + * >>>>>> 0x3d340 967680 443520 1411199 wd0s4a 5 part 0 0 + * + * ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ + * level chunkptr start size end name type subtype flags + * + * Underlying data structure: + * + * Legend: + * --> part + * | + * v next + * + * --> --> + * | | + * | v + * | + * | | + * | v + * | + * | | + * | v + * | + * | + * v + * --> + * | | + * | v + * | + * | + * v + * + * | + * v + * --> + * + * + */ diff --git a/src/include.new/libgen.h b/src/include.new/libgen.h new file mode 100644 index 0000000..df21c66 --- /dev/null +++ b/src/include.new/libgen.h @@ -0,0 +1,49 @@ +/* $OpenBSD: libgen.h,v 1.4 1999/05/28 22:00:22 espie Exp $ */ +/* $FreeBSD: src/include/libgen.h,v 1.2 2002/03/23 17:24:53 imp Exp $ */ + +/* + * Copyright (c) 1997 Todd C. Miller + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _LIBGEN_H_ +#define _LIBGEN_H_ + +#include + +__BEGIN_DECLS + +char *basename(const char *); +char *dirname(const char *); +#if 0 +char *regcmp(const char *, ...); +char *regex(const char *, const char *, ...); + +extern char *__loc1; +#endif + +__END_DECLS + +#endif /* _LIBGEN_H_ */ diff --git a/src/include.new/libgeom.h b/src/include.new/libgeom.h new file mode 100644 index 0000000..17b410b --- /dev/null +++ b/src/include.new/libgeom.h @@ -0,0 +1,149 @@ +/*- + * Copyright (c) 2003 Poul-Henning Kamp + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The names of the authors may not be used to endorse or promote + * products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD: src/lib/libgeom/libgeom.h,v 1.10 2004/03/09 21:14:18 jhb Exp $ + */ +#ifndef _LIBGEOM_H_ +#define _LIBGEOM_H_ + +#include + +#include +#include + +#include + +__BEGIN_DECLS + +void geom_stats_close(void); +void geom_stats_resync(void); +int geom_stats_open(void); +void *geom_stats_snapshot_get(void); +void geom_stats_snapshot_free(void *arg); +void geom_stats_snapshot_timestamp(void *arg, struct timespec *tp); +void geom_stats_snapshot_reset(void *arg); +struct devstat *geom_stats_snapshot_next(void *arg); + +char *geom_getxml(void); + +/* geom_xml2tree.c */ + +/* + * These structs are used to build the tree based on the XML. + * they're named as the kernel variant without the first '_'. + */ + +struct gclass; +struct ggeom; +struct gconsumer; +struct gprovider; + +LIST_HEAD(gconf, gconfig); + +struct gident { + void *lg_id; + void *lg_ptr; + enum { ISCLASS, + ISGEOM, + ISPROVIDER, + ISCONSUMER } lg_what; +}; + +struct gmesh { + LIST_HEAD(, gclass) lg_class; + struct gident *lg_ident; +}; + +struct gconfig { + LIST_ENTRY(gconfig) lg_config; + char *lg_name; + char *lg_val; +}; + +struct gclass { + void *lg_id; + char *lg_name; + LIST_ENTRY(gclass) lg_class; + LIST_HEAD(, ggeom) lg_geom; + struct gconf lg_config; +}; + +struct ggeom { + void *lg_id; + struct gclass *lg_class; + char *lg_name; + u_int lg_rank; + LIST_ENTRY(ggeom) lg_geom; + LIST_HEAD(, gconsumer) lg_consumer; + LIST_HEAD(, gprovider) lg_provider; + struct gconf lg_config; +}; + +struct gconsumer { + void *lg_id; + struct ggeom *lg_geom; + LIST_ENTRY(gconsumer) lg_consumer; + struct gprovider *lg_provider; + LIST_ENTRY(gconsumer) lg_consumers; + char *lg_mode; + struct gconf lg_config; +}; + +struct gprovider { + void *lg_id; + char *lg_name; + struct ggeom *lg_geom; + LIST_ENTRY(gprovider) lg_provider; + LIST_HEAD(, gconsumer) lg_consumers; + char *lg_mode; + off_t lg_mediasize; + u_int lg_sectorsize; + struct gconf lg_config; +}; + +struct gident * geom_lookupid(struct gmesh *gmp, const void *id); +int geom_xml2tree(struct gmesh *gmp, char *p); +int geom_gettree(struct gmesh *gmp); +void geom_deletetree(struct gmesh *gmp); + +/* geom_ctl.c */ + +struct gctl_req; + +#ifdef _STDIO_H_ /* limit #include pollution */ +void gctl_dump(struct gctl_req *req, FILE *f); +#endif +void gctl_free(struct gctl_req *req); +struct gctl_req *gctl_get_handle(void); +const char *gctl_issue(struct gctl_req *req); +void gctl_ro_param(struct gctl_req *req, const char *name, int len, const void* val); +void gctl_rw_param(struct gctl_req *req, const char *name, int len, void* val); + +__END_DECLS + +#endif /* _LIBGEOM_H_ */ diff --git a/src/include.new/libufs.h b/src/include.new/libufs.h new file mode 100644 index 0000000..102477d --- /dev/null +++ b/src/include.new/libufs.h @@ -0,0 +1,135 @@ +/* + * Copyright (c) 2002 Juli Mallett. All rights reserved. + * + * This software was written by Juli Mallett for the + * FreeBSD project. Redistribution and use in source and binary forms, with + * or without modification, are permitted provided that the following + * conditions are met: + * + * 1. Redistribution of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * $FreeBSD: src/lib/libufs/libufs.h,v 1.11 2003/06/09 09:47:38 jmallett Exp $ + */ + +#ifndef __LIBUFS_H__ +#define __LIBUFS_H__ + +/* + * libufs macros (internal, non-exported). + */ +#ifdef _LIBUFS +#ifdef _LIBUFS_DEBUGGING +/* + * Trace steps through libufs, to be used at entry and erroneous return. + */ +#define ERROR(uufsd, str) \ +do { \ + fprintf(stderr, "libufs in %s", __func__); \ + if (str != NULL) \ + fprintf(stderr, ": %s", str); \ + if (errno) \ + fprintf(stderr, ": %s", strerror(errno)); \ + fprintf(stderr, "\n"); \ + if ((uufsd) != NULL) \ + (uufsd)->d_error = str; \ +} while (0) +#else /* _LIBUFS_DEBUGGING */ +#define ERROR(uufsd, str) \ +do { \ + if ((uufsd) != NULL) \ + (uufsd)->d_error = str; \ +} while (0) +#endif /* _LIBUFS_DEBUGGING */ +#endif /* _LIBUFS */ + +/* + * libufs structures. + */ + +/* + * userland ufs disk. + */ +struct uufsd { + const char *d_name; /* disk name */ + int d_ufs; /* decimal UFS version */ + int d_fd; /* raw device file descriptor */ + long d_bsize; /* device bsize */ + ufs2_daddr_t d_sblock; /* superblock location */ + caddr_t d_inoblock; /* inode block */ + ino_t d_inomin; /* low inode */ + ino_t d_inomax; /* high inode */ + union { + struct fs d_fs; /* filesystem information */ + char d_sb[MAXBSIZE]; + /* superblock as buffer */ + } d_sbunion; + union { + struct cg d_cg; /* cylinder group */ + char d_buf[MAXBSIZE]; + /* cylinder group storage */ + } d_cgunion; + int d_ccg; /* current cylinder group */ + int d_lcg; /* last cylinder group (in d_cg) */ + const char *d_error; /* human readable disk error */ + int d_mine; /* internal flags */ +#define d_fs d_sbunion.d_fs +#define d_sb d_sbunion.d_sb +#define d_cg d_cgunion.d_cg +}; + +__BEGIN_DECLS + +/* + * libufs prototypes. + */ + +/* + * block.c + */ +ssize_t bread(struct uufsd *, ufs2_daddr_t, void *, size_t); +ssize_t bwrite(struct uufsd *, ufs2_daddr_t, const void *, size_t); + +/* + * cgroup.c + */ +int cgread(struct uufsd *); +int cgread1(struct uufsd *, int); + +/* + * inode.c + */ +int getino(struct uufsd *, void **, ino_t, int *); + +/* + * sblock.c + */ +int sbread(struct uufsd *); +int sbwrite(struct uufsd *, int); + +/* + * type.c + */ +int ufs_disk_close(struct uufsd *); +int ufs_disk_fillout(struct uufsd *, const char *); +int ufs_disk_fillout_blank(struct uufsd *, const char *); +int ufs_disk_write(struct uufsd *); + +__END_DECLS + +#endif /* __LIBUFS_H__ */ diff --git a/src/include.new/libutil.h b/src/include.new/libutil.h new file mode 100644 index 0000000..ea4141e --- /dev/null +++ b/src/include.new/libutil.h @@ -0,0 +1,160 @@ +/* + * Copyright (c) 1996 Peter Wemm . + * All rights reserved. + * Copyright (c) 2002 Networks Associates Technology, Inc. + * All rights reserved. + * + * Portions of this software were developed for the FreeBSD Project by + * ThinkSec AS and NAI Labs, the Security Research Division of Network + * Associates, Inc. under DARPA/SPAWAR contract N66001-01-C-8035 + * ("CBOSS"), as part of the DARPA CHATS research program. + * + * Redistribution and use in source and binary forms, with or without + * modification, is permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote + * products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD: src/lib/libutil/libutil.h,v 1.40.8.1 2006/01/15 17:50:35 delphij Exp $ + */ + +#ifndef _LIBUTIL_H_ +#define _LIBUTIL_H_ + +#define PROPERTY_MAX_NAME 64 +#define PROPERTY_MAX_VALUE 512 + +/* for properties.c */ +typedef struct _property { + struct _property *next; + char *name; + char *value; +} *properties; + +#ifdef _SYS_PARAM_H_ +/* for pidfile.c */ +struct pidfh { + int pf_fd; + char pf_path[MAXPATHLEN + 1]; + __dev_t pf_dev; + ino_t pf_ino; +}; +#endif + +/* Avoid pulling in all the include files for no need */ +struct termios; +struct winsize; +struct utmp; +struct in_addr; + +__BEGIN_DECLS +void clean_environment(const char * const *_white, + const char * const *_more_white); +int extattr_namespace_to_string(int _attrnamespace, char **_string); +int extattr_string_to_namespace(const char *_string, int *_attrnamespace); +void login(struct utmp *_ut); +int login_tty(int _fd); +int logout(const char *_line); +void logwtmp(const char *_line, const char *_name, const char *_host); +void trimdomain(char *_fullhost, int _hostsize); +int openpty(int *_amaster, int *_aslave, char *_name, + struct termios *_termp, struct winsize *_winp); +int forkpty(int *_amaster, char *_name, + struct termios *_termp, struct winsize *_winp); +int humanize_number(char *_buf, size_t _len, int64_t _number, + const char *_suffix, int _scale, int _flags); +const char *uu_lockerr(int _uu_lockresult); +int uu_lock(const char *_ttyname); +int uu_unlock(const char *_ttyname); +int uu_lock_txfr(const char *_ttyname, pid_t _pid); +int _secure_path(const char *_path, uid_t _uid, gid_t _gid); +properties properties_read(int fd); +void properties_free(properties list); +char *property_find(properties list, const char *name); +char *auth_getval(const char *name); +int realhostname(char *host, size_t hsize, const struct in_addr *ip); +struct sockaddr; +int realhostname_sa(char *host, size_t hsize, struct sockaddr *addr, + int addrlen); +#ifdef _STDIO_H_ /* avoid adding new includes */ +char *fparseln(FILE *, size_t *, size_t *, const char[3], int); +#endif + +#ifdef _PWD_H_ +int pw_copy(int _ffd, int _tfd, const struct passwd *_pw, struct passwd *_old_pw); +struct passwd *pw_dup(const struct passwd *_pw); +int pw_edit(int _notsetuid); +int pw_equal(const struct passwd *_pw1, const struct passwd *_pw2); +void pw_fini(void); +int pw_init(const char *_dir, const char *_master); +char *pw_make(const struct passwd *_pw); +int pw_mkdb(const char *_user); +int pw_lock(void); +struct passwd *pw_scan(const char *_line, int _flags); +const char *pw_tempname(void); +int pw_tmp(int _mfd); +#endif + +#ifdef _SYS_PARAM_H_ +struct pidfh *pidfile_open(const char *path, mode_t mode, pid_t *pidptr); +int pidfile_write(struct pidfh *pfh); +int pidfile_close(struct pidfh *pfh); +int pidfile_remove(struct pidfh *pfh); +#endif +__END_DECLS + +#define UU_LOCK_INUSE (1) +#define UU_LOCK_OK (0) +#define UU_LOCK_OPEN_ERR (-1) +#define UU_LOCK_READ_ERR (-2) +#define UU_LOCK_CREAT_ERR (-3) +#define UU_LOCK_WRITE_ERR (-4) +#define UU_LOCK_LINK_ERR (-5) +#define UU_LOCK_TRY_ERR (-6) +#define UU_LOCK_OWNER_ERR (-7) + +/* return values from realhostname() */ +#define HOSTNAME_FOUND (0) +#define HOSTNAME_INCORRECTNAME (1) +#define HOSTNAME_INVALIDADDR (2) +#define HOSTNAME_INVALIDNAME (3) + +/* fparseln(3) */ +#define FPARSELN_UNESCESC 0x01 +#define FPARSELN_UNESCCONT 0x02 +#define FPARSELN_UNESCCOMM 0x04 +#define FPARSELN_UNESCREST 0x08 +#define FPARSELN_UNESCALL 0x0f + +/* pw_scan() */ +#define PWSCAN_MASTER 0x01 +#define PWSCAN_WARN 0x02 + +/* humanize_number(3) */ +#define HN_DECIMAL 0x01 +#define HN_NOSPACE 0x02 +#define HN_B 0x04 +#define HN_DIVISOR_1000 0x08 + +#define HN_GETSCALE 0x10 +#define HN_AUTOSCALE 0x20 + +#endif /* !_LIBUTIL_H_ */ diff --git a/src/include.new/limits.h b/src/include.new/limits.h new file mode 100644 index 0000000..587f01f --- /dev/null +++ b/src/include.new/limits.h @@ -0,0 +1,134 @@ +/*- + * Copyright (c) 1988, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)limits.h 8.2 (Berkeley) 1/4/94 + * $FreeBSD: src/include/limits.h,v 1.16 2003/04/29 13:35:58 kan Exp $ + */ + +#ifndef _LIMITS_H_ +#define _LIMITS_H_ + +#include + +#if __POSIX_VISIBLE +#define _POSIX_ARG_MAX 4096 +#define _POSIX_CHILD_MAX 25 +#define _POSIX_LINK_MAX 8 +#define _POSIX_MAX_CANON 255 +#define _POSIX_MAX_INPUT 255 +#define _POSIX_NAME_MAX 14 +#define _POSIX_NGROUPS_MAX 8 +#define _POSIX_OPEN_MAX 20 +#define _POSIX_PATH_MAX 256 +#define _POSIX_PIPE_BUF 512 +#define _POSIX_SSIZE_MAX 32767 +#define _POSIX_STREAM_MAX 8 +#define _POSIX_TZNAME_MAX 6 + +#define BC_BASE_MAX 99 /* max ibase/obase values in bc(1) */ +#define BC_DIM_MAX 2048 /* max array elements in bc(1) */ +#define BC_SCALE_MAX 99 /* max scale value in bc(1) */ +#define BC_STRING_MAX 1000 /* max const string length in bc(1) */ +#define COLL_WEIGHTS_MAX 0 /* max weights for order keyword */ +#define EXPR_NEST_MAX 32 /* max expressions nested in expr(1) */ +#define LINE_MAX 2048 /* max bytes in an input line */ +#define RE_DUP_MAX 255 /* max RE's in interval notation */ + +#define _POSIX2_BC_BASE_MAX 99 +#define _POSIX2_BC_DIM_MAX 2048 +#define _POSIX2_BC_SCALE_MAX 99 +#define _POSIX2_BC_STRING_MAX 1000 +#define _POSIX2_EQUIV_CLASS_MAX 2 +#define _POSIX2_EXPR_NEST_MAX 32 +#define _POSIX2_LINE_MAX 2048 +#define _POSIX2_RE_DUP_MAX 255 +#endif + +#if __POSIX_VISIBLE >= 199309 +#define _POSIX_AIO_LISTIO_MAX 16 +#define _POSIX_AIO_MAX 1 +#define _POSIX_DELAYTIMER_MAX 32 +#define _POSIX_MQ_OPEN_MAX 8 +#define _POSIX_MQ_PRIO_MAX 32 +#define _POSIX_RTSIG_MAX 8 +#define _POSIX_SEM_NSEMS_MAX 256 +#define _POSIX_SEM_VALUE_MAX 32767 +#define _POSIX_SIGQUEUE_MAX 32 +#define _POSIX_TIMER_MAX 32 +#endif + +#if __POSIX_VISIBLE >= 199506 +#define _POSIX_THREAD_DESTRUCTOR_ITERATIONS 4 +#define _POSIX_THREAD_KEYS_MAX 128 +#define _POSIX_THREAD_THREADS_MAX 64 +#endif + +#if __POSIX_VISIBLE >= 200112 +#define _POSIX_HOST_NAME_MAX 255 +#define _POSIX_LOGIN_NAME_MAX 9 +#define _POSIX_SS_REPL_MAX 4 +#define _POSIX_SYMLINK_MAX 255 +#define _POSIX_SYMLOOP_MAX 8 +#define _POSIX_TRACE_EVENT_NAME_MAX 30 +#define _POSIX_TRACE_NAME_MAX 8 +#define _POSIX_TRACE_SYS_MAX 8 +#define _POSIX_TRACE_USER_EVENT_MAX 32 +#define _POSIX_TTY_NAME_MAX 9 +#define _POSIX2_CHARCLASS_NAME_MAX 14 +#define _POSIX2_COLL_WEIGHTS_MAX 2 + +#define _POSIX_RE_DUP_MAX _POSIX2_RE_DUP_MAX +#endif + +#if __XSI_VISIBLE +#define _XOPEN_IOV_MAX 16 +#define _XOPEN_NAME_MAX 255 +#define _XOPEN_PATH_MAX 1024 +#define PASS_MAX 128 /* _PASSWORD_LEN from */ + +#define NL_ARGMAX 99 /* max # of position args for printf */ +#define NL_LANGMAX 31 /* max LANG name length */ +#define NL_MSGMAX 32767 +#define NL_NMAX 1 +#define NL_SETMAX 255 +#define NL_TEXTMAX 2048 +#endif + +#define MB_LEN_MAX 6 /* 31-bit UTF-8 */ + +#include + +#if __POSIX_VISIBLE +#include +#endif + +#endif /* !_LIMITS_H_ */ diff --git a/src/include.new/link.h b/src/include.new/link.h new file mode 100644 index 0000000..bb1c737 --- /dev/null +++ b/src/include.new/link.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 1993 Paul Kranenburg + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Paul Kranenburg. + * 4. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * $FreeBSD: src/include/link.h,v 1.25 2002/09/17 01:48:50 peter Exp $ + */ + +#include diff --git a/src/include.new/linker_set.h b/src/include.new/linker_set.h new file mode 100644 index 0000000..2e8d9e0 --- /dev/null +++ b/src/include.new/linker_set.h @@ -0,0 +1,97 @@ +/*- + * Copyright (c) 1999 John D. Polstra + * Copyright (c) 1999,2001 Peter Wemm + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD: src/sys/sys/linker_set.h,v 1.17 2005/03/02 21:33:29 joerg Exp $ + */ + +#ifndef _SYS_LINKER_SET_H_ +#define _SYS_LINKER_SET_H_ + +#ifndef _SYS_CDEFS_H_ +#error this file needs sys/cdefs.h as a prerequisite +#endif + +/* + * The following macros are used to declare global sets of objects, which + * are collected by the linker into a `linker_set' as defined below. + * For ELF, this is done by constructing a separate segment for each set. + */ + +/* + * Private macros, not to be used outside this header file. + */ +#ifdef __GNUCLIKE___SECTION +#define __MAKE_SET(set, sym) \ + static void const * const __set_##set##_sym_##sym \ + __section("set_" #set) __used = &sym +#else /* !__GNUCLIKE___SECTION */ +#ifndef lint +#error this file needs to be ported to your compiler +#endif /* lint */ +#define __MAKE_SET(set, sym) extern void const * const (__set_##set##_sym_##sym) +#endif /* __GNUCLIKE___SECTION */ + +/* + * Public macros. + */ +#define TEXT_SET(set, sym) __MAKE_SET(set, sym) +#define DATA_SET(set, sym) __MAKE_SET(set, sym) +#define BSS_SET(set, sym) __MAKE_SET(set, sym) +#define ABS_SET(set, sym) __MAKE_SET(set, sym) +#define SET_ENTRY(set, sym) __MAKE_SET(set, sym) + +/* + * Initialize before referring to a given linker set. + */ +#define SET_DECLARE(set, ptype) \ + extern ptype *__CONCAT(__start_set_,set); \ + extern ptype *__CONCAT(__stop_set_,set) + +#define SET_BEGIN(set) \ + (&__CONCAT(__start_set_,set)) +#define SET_LIMIT(set) \ + (&__CONCAT(__stop_set_,set)) + +/* + * Iterate over all the elements of a set. + * + * Sets always contain addresses of things, and "pvar" points to words + * containing those addresses. Thus is must be declared as "type **pvar", + * and the address of each set item is obtained inside the loop by "*pvar". + */ +#define SET_FOREACH(pvar, set) \ + for (pvar = SET_BEGIN(set); pvar < SET_LIMIT(set); pvar++) + +#define SET_ITEM(set, i) \ + ((SET_BEGIN(set))[i]) + +/* + * Provide a count of the items in a set. + */ +#define SET_COUNT(set) \ + (SET_LIMIT(set) - SET_BEGIN(set)) + +#endif /* _SYS_LINKER_SET_H_ */ diff --git a/src/include.new/locale.h b/src/include.new/locale.h new file mode 100644 index 0000000..b5a48ea --- /dev/null +++ b/src/include.new/locale.h @@ -0,0 +1,86 @@ +/* + * Copyright (c) 1991, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)locale.h 8.1 (Berkeley) 6/2/93 + * $FreeBSD: src/include/locale.h,v 1.8 2003/12/07 21:10:06 marcel Exp $ + */ + +#ifndef _LOCALE_H_ +#define _LOCALE_H_ + +#include + +struct lconv { + char *decimal_point; + char *thousands_sep; + char *grouping; + char *int_curr_symbol; + char *currency_symbol; + char *mon_decimal_point; + char *mon_thousands_sep; + char *mon_grouping; + char *positive_sign; + char *negative_sign; + char int_frac_digits; + char frac_digits; + char p_cs_precedes; + char p_sep_by_space; + char n_cs_precedes; + char n_sep_by_space; + char p_sign_posn; + char n_sign_posn; + char int_p_cs_precedes; + char int_n_cs_precedes; + char int_p_sep_by_space; + char int_n_sep_by_space; + char int_p_sign_posn; + char int_n_sign_posn; +}; + +#define LC_ALL 0 +#define LC_COLLATE 1 +#define LC_CTYPE 2 +#define LC_MONETARY 3 +#define LC_NUMERIC 4 +#define LC_TIME 5 +#define LC_MESSAGES 6 + +#define _LC_LAST 7 /* marks end */ + +#include + +__BEGIN_DECLS +struct lconv *localeconv(void); +char *setlocale(int, const char *); +__END_DECLS + +#endif /* _LOCALE_H_ */ diff --git a/src/include.new/login_cap.h b/src/include.new/login_cap.h new file mode 100644 index 0000000..7860c99 --- /dev/null +++ b/src/include.new/login_cap.h @@ -0,0 +1,158 @@ +/*- + * Copyright (c) 1996 by + * Sean Eric Fagan + * David Nugent + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, is permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice immediately at the beginning of the file, without modification, + * this list of conditions, and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. This work was done expressly for inclusion into FreeBSD. Other use + * is permitted provided this notation is included. + * 4. Absolutely no warranty of function or purpose is made by the authors. + * 5. Modifications may be freely made to this file providing the above + * conditions are met. + * + * Low-level routines relating to the user capabilities database + * + * Was login_cap.h,v 1.9 1997/05/07 20:00:01 eivind Exp + * $FreeBSD: src/lib/libutil/login_cap.h,v 1.9 2003/10/18 10:04:16 markm Exp $ + */ + +#ifndef _LOGIN_CAP_H_ +#define _LOGIN_CAP_H_ + +#define LOGIN_DEFCLASS "default" +#define LOGIN_DEFROOTCLASS "root" +#define LOGIN_MECLASS "me" +#define LOGIN_DEFSTYLE "passwd" +#define LOGIN_DEFSERVICE "login" +#define LOGIN_DEFUMASK 022 +#define LOGIN_DEFPRI 0 +#define _PATH_LOGIN_CONF "/etc/login.conf" +#define _FILE_LOGIN_CONF ".login_conf" +#define _PATH_AUTHPROG "/usr/libexec/login_" + +#define LOGIN_SETGROUP 0x0001 /* set group */ +#define LOGIN_SETLOGIN 0x0002 /* set login (via setlogin) */ +#define LOGIN_SETPATH 0x0004 /* set path */ +#define LOGIN_SETPRIORITY 0x0008 /* set priority */ +#define LOGIN_SETRESOURCES 0x0010 /* set resources (cputime, etc.) */ +#define LOGIN_SETUMASK 0x0020 /* set umask, obviously */ +#define LOGIN_SETUSER 0x0040 /* set user (via setuid) */ +#define LOGIN_SETENV 0x0080 /* set user environment */ +#define LOGIN_SETMAC 0x0100 /* set user default MAC label */ +#define LOGIN_SETALL 0x01ff /* set everything */ + +#define BI_AUTH "authorize" /* accepted authentication */ +#define BI_REJECT "reject" /* rejected authentication */ +#define BI_CHALLENG "reject challenge" /* reject with a challenge */ +#define BI_SILENT "reject silent" /* reject silently */ +#define BI_REMOVE "remove" /* remove file on error */ +#define BI_ROOTOKAY "authorize root" /* root authenticated */ +#define BI_SECURE "authorize secure" /* okay on non-secure line */ +#define BI_SETENV "setenv" /* set environment variable */ +#define BI_VALUE "value" /* set local variable */ + +#define AUTH_OKAY 0x01 /* user authenticated */ +#define AUTH_ROOTOKAY 0x02 /* root login okay */ +#define AUTH_SECURE 0x04 /* secure login */ +#define AUTH_SILENT 0x08 /* silent rejection */ +#define AUTH_CHALLENGE 0x10 /* a chellenge was given */ + +#define AUTH_ALLOW (AUTH_OKAY | AUTH_ROOTOKAY | AUTH_SECURE) + +typedef struct login_cap { + char *lc_class; + char *lc_cap; + char *lc_style; +} login_cap_t; + +typedef struct login_time { + u_short lt_start; /* Start time */ + u_short lt_end; /* End time */ +#define LTM_NONE 0x00 +#define LTM_SUN 0x01 +#define LTM_MON 0x02 +#define LTM_TUE 0x04 +#define LTM_WED 0x08 +#define LTM_THU 0x10 +#define LTM_FRI 0x20 +#define LTM_SAT 0x40 +#define LTM_ANY 0x7F +#define LTM_WK 0x3E +#define LTM_WD 0x41 + u_char lt_dow; /* Days of week */ +} login_time_t; + +#define LC_MAXTIMES 64 + +#include +__BEGIN_DECLS +struct passwd; + +void login_close(login_cap_t *); +login_cap_t *login_getclassbyname(const char *, const struct passwd *); +login_cap_t *login_getclass(const char *); +login_cap_t *login_getpwclass(const struct passwd *); +login_cap_t *login_getuserclass(const struct passwd *); + +const char *login_getcapstr(login_cap_t*, const char *, const char *, const char *); +const char **login_getcaplist(login_cap_t *, const char *, const char *); +const char *login_getstyle(login_cap_t *, const char *, const char *); +rlim_t login_getcaptime(login_cap_t *, const char *, rlim_t, rlim_t); +rlim_t login_getcapnum(login_cap_t *, const char *, rlim_t, rlim_t); +rlim_t login_getcapsize(login_cap_t *, const char *, rlim_t, rlim_t); +const char *login_getpath(login_cap_t *, const char *, const char *); +int login_getcapbool(login_cap_t *, const char *, int); +const char *login_setcryptfmt(login_cap_t *, const char *, const char *); + +int setclasscontext(const char*, unsigned int); +int setusercontext(login_cap_t*, const struct passwd*, uid_t, unsigned int); +void setclassresources(login_cap_t *); +void setclassenvironment(login_cap_t *, const struct passwd *, int); + +/* Most of these functions are deprecated */ +int auth_approve(login_cap_t*, const char*, const char*); +int auth_check(const char *, const char *, const char *, const char *, int *); +void auth_env(void); +char *auth_mkvalue(const char *n); +int auth_response(const char *, const char *, const char *, const char *, int *, const char *, const char *); +void auth_rmfiles(void); +int auth_scan(int); +int auth_script(const char*, ...); +int auth_script_data(const char *, int, const char *, ...); +char *auth_valud(const char *); +int auth_setopt(const char *, const char *); +void auth_clropts(void); + +void auth_checknologin(login_cap_t*); +int auth_cat(const char*); + +int auth_ttyok(login_cap_t*, const char *); +int auth_hostok(login_cap_t*, const char *, char const *); +int auth_timeok(login_cap_t*, time_t); + +struct tm; + +login_time_t parse_lt(const char *); +int in_ltm(const login_time_t *, struct tm *, time_t *); +int in_ltms(const login_time_t *, struct tm *, time_t *); + +/* helper functions */ + +int login_strinlist(const char **, char const *, int); +int login_str2inlist(const char **, const char *, const char *, int); +login_time_t * login_timelist(login_cap_t *, char const *, int *, login_time_t **); +int login_ttyok(login_cap_t *, const char *, const char *, const char *); +int login_hostok(login_cap_t *, const char *, const char *, const char *, const char *); + +__END_DECLS + +#endif /* _LOGIN_CAP_H_ */ diff --git a/src/include.new/magic.h b/src/include.new/magic.h new file mode 100644 index 0000000..869f9ea --- /dev/null +++ b/src/include.new/magic.h @@ -0,0 +1,67 @@ +/* + * Copyright (c) Christos Zoulas 2003. + * All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice immediately at the beginning of the file, without modification, + * this list of conditions, and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ +#ifndef _MAGIC_H +#define _MAGIC_H + +#include + +#define MAGIC_NONE 0x000 /* No flags */ +#define MAGIC_DEBUG 0x001 /* Turn on debugging */ +#define MAGIC_SYMLINK 0x002 /* Follow symlinks */ +#define MAGIC_COMPRESS 0x004 /* Check inside compressed files */ +#define MAGIC_DEVICES 0x008 /* Look at the contents of devices */ +#define MAGIC_MIME 0x010 /* Return a mime string */ +#define MAGIC_CONTINUE 0x020 /* Return all matches */ +#define MAGIC_CHECK 0x040 /* Print warnings to stderr */ +#define MAGIC_PRESERVE_ATIME 0x080 /* Restore access time on exit */ +#define MAGIC_RAW 0x100 /* Don't translate unprintable chars */ +#define MAGIC_ERROR 0x200 /* Handle ENOENT etc as real errors */ + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct magic_set *magic_t; +magic_t magic_open(int); +void magic_close(magic_t); + +const char *magic_file(magic_t, const char *); +const char *magic_buffer(magic_t, const void *, size_t); + +const char *magic_error(magic_t); +int magic_setflags(magic_t, int); + +int magic_load(magic_t, const char *); +int magic_compile(magic_t, const char *); +int magic_check(magic_t, const char *); +int magic_errno(magic_t); + +#ifdef __cplusplus +}; +#endif + +#endif /* _MAGIC_H */ diff --git a/src/include.new/malloc.h b/src/include.new/malloc.h new file mode 100644 index 0000000..0688aaa --- /dev/null +++ b/src/include.new/malloc.h @@ -0,0 +1,6 @@ +/* $FreeBSD: src/include/malloc.h,v 1.5 2001/11/07 23:14:31 obrien Exp $ */ +#if __STDC__ +#error " has been replaced by " +#else +#include +#endif diff --git a/src/include.new/math.h b/src/include.new/math.h new file mode 100644 index 0000000..dd57028 --- /dev/null +++ b/src/include.new/math.h @@ -0,0 +1,473 @@ +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunPro, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + */ + +/* + * from: @(#)fdlibm.h 5.1 93/09/24 + * $FreeBSD: src/lib/msun/src/math.h,v 1.61 2005/04/16 21:12:47 das Exp $ + */ + +#ifndef _MATH_H_ +#define _MATH_H_ + +#include +#include +#include + +/* + * ANSI/POSIX + */ +extern const union __infinity_un { + unsigned char __uc[8]; + double __ud; +} __infinity; + +extern const union __nan_un { + unsigned char __uc[sizeof(float)]; + float __uf; +} __nan; + +#if __GNUC_PREREQ__(3, 3) || (defined(__INTEL_COMPILER) && __INTEL_COMPILER >= 800) +#define __MATH_BUILTIN_CONSTANTS +#endif + +#if __GNUC_PREREQ__(3, 0) && !defined(__INTEL_COMPILER) +#define __MATH_BUILTIN_RELOPS +#endif + +#ifdef __MATH_BUILTIN_CONSTANTS +#define HUGE_VAL __builtin_huge_val() +#else +#define HUGE_VAL (__infinity.__ud) +#endif + +#if __ISO_C_VISIBLE >= 1999 +#define FP_ILOGB0 (-__INT_MAX) +#define FP_ILOGBNAN __INT_MAX + +#ifdef __MATH_BUILTIN_CONSTANTS +#define HUGE_VALF __builtin_huge_valf() +#define HUGE_VALL __builtin_huge_vall() +#define INFINITY __builtin_inf() +#define NAN __builtin_nan("") +#else +#define HUGE_VALF (float)HUGE_VAL +#define HUGE_VALL (long double)HUGE_VAL +#define INFINITY HUGE_VALF +#define NAN (__nan.__uf) +#endif /* __MATH_BUILTIN_CONSTANTS */ + +#define MATH_ERRNO 1 +#define MATH_ERREXCEPT 2 +#define math_errhandling MATH_ERREXCEPT + +/* XXX We need a . */ +#if defined(__ia64__) || defined(__sparc64__) +#define FP_FAST_FMA +#endif +#ifdef __ia64__ +#define FP_FAST_FMAL +#endif +#define FP_FAST_FMAF + +/* Symbolic constants to classify floating point numbers. */ +#define FP_INFINITE 0x01 +#define FP_NAN 0x02 +#define FP_NORMAL 0x04 +#define FP_SUBNORMAL 0x08 +#define FP_ZERO 0x10 +#define fpclassify(x) \ + ((sizeof (x) == sizeof (float)) ? __fpclassifyf(x) \ + : (sizeof (x) == sizeof (double)) ? __fpclassifyd(x) \ + : __fpclassifyl(x)) + +#define isfinite(x) \ + ((sizeof (x) == sizeof (float)) ? __isfinitef(x) \ + : (sizeof (x) == sizeof (double)) ? __isfinite(x) \ + : __isfinitel(x)) +#define isinf(x) \ + ((sizeof (x) == sizeof (float)) ? __isinff(x) \ + : (sizeof (x) == sizeof (double)) ? isinf(x) \ + : __isinfl(x)) +#define isnan(x) \ + ((sizeof (x) == sizeof (float)) ? isnanf(x) \ + : (sizeof (x) == sizeof (double)) ? isnan(x) \ + : __isnanl(x)) +#define isnormal(x) \ + ((sizeof (x) == sizeof (float)) ? __isnormalf(x) \ + : (sizeof (x) == sizeof (double)) ? __isnormal(x) \ + : __isnormall(x)) + +#ifdef __MATH_BUILTIN_RELOPS +#define isgreater(x, y) __builtin_isgreater((x), (y)) +#define isgreaterequal(x, y) __builtin_isgreaterequal((x), (y)) +#define isless(x, y) __builtin_isless((x), (y)) +#define islessequal(x, y) __builtin_islessequal((x), (y)) +#define islessgreater(x, y) __builtin_islessgreater((x), (y)) +#define isunordered(x, y) __builtin_isunordered((x), (y)) +#else +#define isgreater(x, y) (!isunordered((x), (y)) && (x) > (y)) +#define isgreaterequal(x, y) (!isunordered((x), (y)) && (x) >= (y)) +#define isless(x, y) (!isunordered((x), (y)) && (x) < (y)) +#define islessequal(x, y) (!isunordered((x), (y)) && (x) <= (y)) +#define islessgreater(x, y) (!isunordered((x), (y)) && \ + ((x) > (y) || (y) > (x))) +#define isunordered(x, y) (isnan(x) || isnan(y)) +#endif /* __MATH_BUILTIN_RELOPS */ + +#define signbit(x) \ + ((sizeof (x) == sizeof (float)) ? __signbitf(x) \ + : (sizeof (x) == sizeof (double)) ? __signbit(x) \ + : __signbitl(x)) + +typedef __double_t double_t; +typedef __float_t float_t; +#endif /* __ISO_C_VISIBLE >= 1999 */ + +/* + * XOPEN/SVID + */ +#if __BSD_VISIBLE || __XSI_VISIBLE +#define M_E 2.7182818284590452354 /* e */ +#define M_LOG2E 1.4426950408889634074 /* log 2e */ +#define M_LOG10E 0.43429448190325182765 /* log 10e */ +#define M_LN2 0.69314718055994530942 /* log e2 */ +#define M_LN10 2.30258509299404568402 /* log e10 */ +#define M_PI 3.14159265358979323846 /* pi */ +#define M_PI_2 1.57079632679489661923 /* pi/2 */ +#define M_PI_4 0.78539816339744830962 /* pi/4 */ +#define M_1_PI 0.31830988618379067154 /* 1/pi */ +#define M_2_PI 0.63661977236758134308 /* 2/pi */ +#define M_2_SQRTPI 1.12837916709551257390 /* 2/sqrt(pi) */ +#define M_SQRT2 1.41421356237309504880 /* sqrt(2) */ +#define M_SQRT1_2 0.70710678118654752440 /* 1/sqrt(2) */ + +#define MAXFLOAT ((float)3.40282346638528860e+38) +extern int signgam; +#endif /* __BSD_VISIBLE || __XSI_VISIBLE */ + +#if __BSD_VISIBLE +#if 0 +/* Old value from 4.4BSD-Lite math.h; this is probably better. */ +#define HUGE HUGE_VAL +#else +#define HUGE MAXFLOAT +#endif +#endif /* __BSD_VISIBLE */ + +/* + * Most of these functions depend on the rounding mode and have the side + * effect of raising floating-point exceptions, so they are not declared + * as __pure2. In C99, FENV_ACCESS affects the purity of these functions. + */ +__BEGIN_DECLS +/* + * ANSI/POSIX + */ +int __fpclassifyd(double) __pure2; +int __fpclassifyf(float) __pure2; +int __fpclassifyl(long double) __pure2; +int __isfinitef(float) __pure2; +int __isfinite(double) __pure2; +int __isfinitel(long double) __pure2; +int __isinff(float) __pure2; +int __isinfl(long double) __pure2; +int __isnanl(long double) __pure2; +int __isnormalf(float) __pure2; +int __isnormal(double) __pure2; +int __isnormall(long double) __pure2; +int __signbit(double) __pure2; +int __signbitf(float) __pure2; +int __signbitl(long double) __pure2; + +double acos(double); +double asin(double); +double atan(double); +double atan2(double, double); +double cos(double); +double sin(double); +double tan(double); + +double cosh(double); +double sinh(double); +double tanh(double); + +double exp(double); +double frexp(double, int *); /* fundamentally !__pure2 */ +double ldexp(double, int); +double log(double); +double log10(double); +double modf(double, double *); /* fundamentally !__pure2 */ + +double pow(double, double); +double sqrt(double); + +double ceil(double); +double fabs(double) __pure2; +double floor(double); +double fmod(double, double); + +/* + * These functions are not in C90. + */ +#if __BSD_VISIBLE || __ISO_C_VISIBLE >= 1999 || __XSI_VISIBLE +double acosh(double); +double asinh(double); +double atanh(double); +double cbrt(double); +double erf(double); +double erfc(double); +double exp2(double); +double expm1(double); +double fma(double, double, double); +double hypot(double, double); +int ilogb(double) __pure2; +int (isinf)(double) __pure2; +int (isnan)(double) __pure2; +double lgamma(double); +long long llrint(double); +long long llround(double); +double log1p(double); +double logb(double); +long lrint(double); +long lround(double); +double nextafter(double, double); +double remainder(double, double); +double remquo(double, double, int *); +double rint(double); +#endif /* __BSD_VISIBLE || __ISO_C_VISIBLE >= 1999 || __XSI_VISIBLE */ + +#if __BSD_VISIBLE || __XSI_VISIBLE +double j0(double); +double j1(double); +double jn(int, double); +double scalb(double, double); +double y0(double); +double y1(double); +double yn(int, double); + +#if __XSI_VISIBLE <= 500 || __BSD_VISIBLE +double gamma(double); +#endif +#endif /* __BSD_VISIBLE || __XSI_VISIBLE */ + +#if __BSD_VISIBLE || __ISO_C_VISIBLE >= 1999 +double copysign(double, double) __pure2; +double fdim(double, double); +double fmax(double, double) __pure2; +double fmin(double, double) __pure2; +double nearbyint(double); +double round(double); +double scalbln(double, long); +double scalbn(double, int); +double tgamma(double); +double trunc(double); +#endif + +/* + * BSD math library entry points + */ +#if __BSD_VISIBLE +double drem(double, double); +int finite(double) __pure2; +int isnanf(float) __pure2; + +/* + * Reentrant version of gamma & lgamma; passes signgam back by reference + * as the second argument; user must allocate space for signgam. + */ +double gamma_r(double, int *); +double lgamma_r(double, int *); + +/* + * IEEE Test Vector + */ +double significand(double); +#endif /* __BSD_VISIBLE */ + +/* float versions of ANSI/POSIX functions */ +#if __ISO_C_VISIBLE >= 1999 +float acosf(float); +float asinf(float); +float atanf(float); +float atan2f(float, float); +float cosf(float); +float sinf(float); +float tanf(float); + +float coshf(float); +float sinhf(float); +float tanhf(float); + +float exp2f(float); +float expf(float); +float expm1f(float); +float frexpf(float, int *); /* fundamentally !__pure2 */ +int ilogbf(float) __pure2; +float ldexpf(float, int); +float log10f(float); +float log1pf(float); +float logf(float); +float modff(float, float *); /* fundamentally !__pure2 */ + +float powf(float, float); +float sqrtf(float); + +float ceilf(float); +float fabsf(float) __pure2; +float floorf(float); +float fmodf(float, float); +float roundf(float); + +float erff(float); +float erfcf(float); +float hypotf(float, float); +float lgammaf(float); + +float acoshf(float); +float asinhf(float); +float atanhf(float); +float cbrtf(float); +float logbf(float); +float copysignf(float, float) __pure2; +long long llrintf(float); +long long llroundf(float); +long lrintf(float); +long lroundf(float); +float nearbyintf(float); +float nextafterf(float, float); +float remainderf(float, float); +float remquof(float, float, int *); +float rintf(float); +float scalblnf(float, long); +float scalbnf(float, int); +float truncf(float); + +float fdimf(float, float); +float fmaf(float, float, float); +float fmaxf(float, float) __pure2; +float fminf(float, float) __pure2; +#endif + +/* + * float versions of BSD math library entry points + */ +#if __BSD_VISIBLE +float dremf(float, float); +int finitef(float) __pure2; +float gammaf(float); +float j0f(float); +float j1f(float); +float jnf(int, float); +float scalbf(float, float); +float y0f(float); +float y1f(float); +float ynf(int, float); + +/* + * Float versions of reentrant version of gamma & lgamma; passes + * signgam back by reference as the second argument; user must + * allocate space for signgam. + */ +float gammaf_r(float, int *); +float lgammaf_r(float, int *); + +/* + * float version of IEEE Test Vector + */ +float significandf(float); +#endif /* __BSD_VISIBLE */ + +/* + * long double versions of ISO/POSIX math functions + */ +#if __ISO_C_VISIBLE >= 1999 +#if 0 +long double acoshl(long double); +long double acosl(long double); +long double asinhl(long double); +long double asinl(long double); +long double atan2l(long double, long double); +long double atanhl(long double); +long double atanl(long double); +long double cbrtl(long double); +#endif +long double ceill(long double); +long double copysignl(long double, long double) __pure2; +#if 0 +long double coshl(long double); +long double cosl(long double); +long double erfcl(long double); +long double erfl(long double); +long double exp2l(long double); +long double expl(long double); +long double expm1l(long double); +#endif +long double fabsl(long double) __pure2; +long double fdiml(long double, long double); +long double floorl(long double); +long double fmal(long double, long double, long double); +long double fmaxl(long double, long double) __pure2; +long double fminl(long double, long double) __pure2; +#if 0 +long double fmodl(long double, long double); +#endif +long double frexpl(long double value, int *); /* fundamentally !__pure2 */ +#if 0 +long double hypotl(long double, long double); +#endif +int ilogbl(long double) __pure2; +long double ldexpl(long double, int); +#if 0 +long double lgammal(long double); +long long llrintl(long double); +#endif +long long llroundl(long double); +#if 0 +long double log10l(long double); +long double log1pl(long double); +long double log2l(long double); +long double logbl(long double); +long double logl(long double); +long lrintl(long double); +#endif +long lroundl(long double); +#if 0 +long double modfl(long double, long double *); /* fundamentally !__pure2 */ +long double nanl(const char *) __pure2; +long double nearbyintl(long double); +#endif +long double nextafterl(long double, long double); +double nexttoward(double, long double); +float nexttowardf(float, long double); +long double nexttowardl(long double, long double); +#if 0 +long double powl(long double, long double); +long double remainderl(long double, long double); +long double remquol(long double, long double, int *); +long double rintl(long double); +#endif +long double roundl(long double); +long double scalblnl(long double, long); +long double scalbnl(long double, int); +#if 0 +long double sinhl(long double); +long double sinl(long double); +long double sqrtl(long double); +long double tanhl(long double); +long double tanl(long double); +long double tgammal(long double); +#endif +long double truncl(long double); + +#endif /* __ISO_C_VISIBLE >= 1999 */ +__END_DECLS + +#endif /* !_MATH_H_ */ diff --git a/src/include.new/md2.h b/src/include.new/md2.h new file mode 100644 index 0000000..4b1adef --- /dev/null +++ b/src/include.new/md2.h @@ -0,0 +1,46 @@ +/* MD2.H - header file for MD2C.C + * $FreeBSD: src/lib/libmd/md2.h,v 1.9 2001/03/17 10:00:50 phk Exp $ + */ + +/* Copyright (C) 1990-2, RSA Data Security, Inc. Created 1990. All + rights reserved. + + License to copy and use this software is granted for + non-commercial Internet Privacy-Enhanced Mail provided that it is + identified as the "RSA Data Security, Inc. MD2 Message Digest + Algorithm" in all material mentioning or referencing this software + or this function. + + RSA Data Security, Inc. makes no representations concerning either + the merchantability of this software or the suitability of this + software for any particular purpose. It is provided "as is" + without express or implied warranty of any kind. + + These notices must be retained in any copies of any part of this + documentation and/or software. + */ + +#ifndef _MD2_H_ +#define _MD2_H_ + +typedef struct MD2Context { + unsigned char state[16]; /* state */ + unsigned char checksum[16]; /* checksum */ + unsigned int count; /* number of bytes, modulo 16 */ + unsigned char buffer[16]; /* input buffer */ +} MD2_CTX; + +#include + +__BEGIN_DECLS +void MD2Init(MD2_CTX *); +void MD2Update(MD2_CTX *, const unsigned char *, unsigned int); +void MD2Pad(MD2_CTX *); +void MD2Final(unsigned char [16], MD2_CTX *); +char * MD2End(MD2_CTX *, char *); +char * MD2File(const char *, char *); +char * MD2FileChunk(const char *, char *, off_t, off_t); +char * MD2Data(const unsigned char *, unsigned int, char *); +__END_DECLS + +#endif /* _MD2_H_ */ diff --git a/src/include.new/md4.h b/src/include.new/md4.h new file mode 100644 index 0000000..0c2eaed --- /dev/null +++ b/src/include.new/md4.h @@ -0,0 +1,48 @@ +/* MD4.H - header file for MD4C.C + * $FreeBSD: src/lib/libmd/md4.h,v 1.10 2001/03/17 10:00:50 phk Exp $ + */ + +/* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All + rights reserved. + + License to copy and use this software is granted provided that it + is identified as the "RSA Data Security, Inc. MD4 Message-Digest + Algorithm" in all material mentioning or referencing this software + or this function. + License is also granted to make and use derivative works provided + that such works are identified as "derived from the RSA Data + Security, Inc. MD4 Message-Digest Algorithm" in all material + mentioning or referencing the derived work. + + RSA Data Security, Inc. makes no representations concerning either + the merchantability of this software or the suitability of this + software for any particular purpose. It is provided "as is" + without express or implied warranty of any kind. + + These notices must be retained in any copies of any part of this + documentation and/or software. + */ + +#ifndef _MD4_H_ +#define _MD4_H_ +/* MD4 context. */ +typedef struct MD4Context { + u_int32_t state[4]; /* state (ABCD) */ + u_int32_t count[2]; /* number of bits, modulo 2^64 (lsb first) */ + unsigned char buffer[64]; /* input buffer */ +} MD4_CTX; + +#include + +__BEGIN_DECLS +void MD4Init(MD4_CTX *); +void MD4Update(MD4_CTX *, const unsigned char *, unsigned int); +void MD4Pad(MD4_CTX *); +void MD4Final(unsigned char [16], MD4_CTX *); +char * MD4End(MD4_CTX *, char *); +char * MD4File(const char *, char *); +char * MD4FileChunk(const char *, char *, off_t, off_t); +char * MD4Data(const unsigned char *, unsigned int, char *); +__END_DECLS + +#endif /* _MD4_H_ */ diff --git a/src/include.new/md5.h b/src/include.new/md5.h new file mode 100644 index 0000000..803a88f --- /dev/null +++ b/src/include.new/md5.h @@ -0,0 +1,4 @@ +#ifndef _MD5_H_ +#define _MD5_H_ +#include +#endif /* _MD5_H_ */ diff --git a/src/include.new/memory.h b/src/include.new/memory.h new file mode 100644 index 0000000..cb9c8b5 --- /dev/null +++ b/src/include.new/memory.h @@ -0,0 +1,36 @@ +/* + * Copyright (c) 1988, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)memory.h 8.1 (Berkeley) 6/2/93 + */ + +#include diff --git a/src/include.new/memstat.h b/src/include.new/memstat.h new file mode 100644 index 0000000..48b3a95 --- /dev/null +++ b/src/include.new/memstat.h @@ -0,0 +1,174 @@ +/*- + * Copyright (c) 2005 Robert N. M. Watson + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD: src/lib/libmemstat/memstat.h,v 1.7.2.3 2005/11/09 10:22:28 rwatson Exp $ + */ + +#ifndef _MEMSTAT_H_ +#define _MEMSTAT_H_ + +/* + * Number of CPU slots in library-internal data structures. This should be + * at least the value of MAXCPU from param.h. + */ +#define MEMSTAT_MAXCPU 16 + +/* + * Amount of caller data to maintain for each caller data slot. Applications + * must not request more than this number of caller save data, or risk + * corrupting internal libmemstat(3) data structures. A compile time check + * in the application is probably appropriate. + */ +#define MEMSTAT_MAXCALLER 16 + +/* + * libmemstat(3) is able to extract memory data from different allocators; + * when it does so, it tags which allocator it got the data from so that + * consumers can determine which fields are usable, as data returned varies + * some. + */ +#define ALLOCATOR_UNKNOWN 0 +#define ALLOCATOR_MALLOC 1 +#define ALLOCATOR_UMA 2 +#define ALLOCATOR_ANY 255 + +/* + * Library maximum type name. Should be max(set of name maximums over + * various allocators). + */ +#define MEMTYPE_MAXNAME 32 + +/* + * Library error conditions, mostly from the underlying data sources. On + * failure, functions typically return (-1) or (NULL); on success, (0) or a + * valid data pointer. The error from the last operation is stored in + * struct memory_type, and accessed via memstat_get_error(mtp). + */ +#define MEMSTAT_ERROR_UNDEFINED 0 /* Initialization value. */ +#define MEMSTAT_ERROR_NOMEMORY 1 /* Out of memory. */ +#define MEMSTAT_ERROR_VERSION 2 /* Unsupported version. */ +#define MEMSTAT_ERROR_PERMISSION 3 /* Permission denied. */ +#define MEMSTAT_ERROR_TOOMANYCPUS 4 /* Too many CPUs. */ +#define MEMSTAT_ERROR_DATAERROR 5 /* Error in stat data. */ +#define MEMSTAT_ERROR_KVM 6 /* See kvm_geterr() for err. */ +#define MEMSTAT_ERROR_KVM_NOSYMBOL 7 /* Symbol not available. */ +#define MEMSTAT_ERROR_KVM_SHORTREAD 8 /* Short kvm_read return. */ + +/* + * Forward declare struct memory_type, which holds per-type properties and + * statistics. This is an opaque type, to be frobbed only from within the + * library, in order to avoid building ABI assumptions into the application. + * Accessor methods should be used to get and sometimes set the fields from + * consumers of the library. + */ +struct memory_type; + +/* + * struct memory_type_list is the head of a list of memory types and + * statistics. + */ +struct memory_type_list; + +__BEGIN_DECLS +/* + * Functions that operate without memory type or memory type list context. + */ +const char *memstat_strerror(int error); + +/* + * Functions for managing memory type and statistics data. + */ +struct memory_type_list *memstat_mtl_alloc(void); +struct memory_type *memstat_mtl_first(struct memory_type_list *list); +struct memory_type *memstat_mtl_next(struct memory_type *mtp); +struct memory_type *memstat_mtl_find(struct memory_type_list *list, + int allocator, const char *name); +void memstat_mtl_free(struct memory_type_list *list); +int memstat_mtl_geterror(struct memory_type_list *list); + +/* + * Functions to retrieve data from a live kernel using sysctl. + */ +int memstat_sysctl_all(struct memory_type_list *list, int flags); +int memstat_sysctl_malloc(struct memory_type_list *list, int flags); +int memstat_sysctl_uma(struct memory_type_list *list, int flags); + +/* + * Functions to retrieve data from a kernel core (or /dev/kmem). + */ +int memstat_kvm_all(struct memory_type_list *list, void *kvm_handle); +int memstat_kvm_malloc(struct memory_type_list *list, void *kvm_handle); +int memstat_kvm_uma(struct memory_type_list *list, void *kvm_handle); + +/* + * Accessor methods for struct memory_type. + */ +const char *memstat_get_name(const struct memory_type *mtp); +int memstat_get_allocator(const struct memory_type *mtp); +uint64_t memstat_get_countlimit(const struct memory_type *mtp); +uint64_t memstat_get_byteslimit(const struct memory_type *mtp); +uint64_t memstat_get_sizemask(const struct memory_type *mtp); +uint64_t memstat_get_size(const struct memory_type *mtp); +uint64_t memstat_get_memalloced(const struct memory_type *mtp); +uint64_t memstat_get_memfreed(const struct memory_type *mtp); +uint64_t memstat_get_numallocs(const struct memory_type *mtp); +uint64_t memstat_get_numfrees(const struct memory_type *mtp); +uint64_t memstat_get_bytes(const struct memory_type *mtp); +uint64_t memstat_get_count(const struct memory_type *mtp); +uint64_t memstat_get_free(const struct memory_type *mtp); +uint64_t memstat_get_failures(const struct memory_type *mtp); +void *memstat_get_caller_pointer(const struct memory_type *mtp, + int index); +void memstat_set_caller_pointer(struct memory_type *mtp, + int index, void *value); +uint64_t memstat_get_caller_uint64(const struct memory_type *mtp, + int index); +void memstat_set_caller_uint64(struct memory_type *mtp, int index, + uint64_t value); +uint64_t memstat_get_zonefree(const struct memory_type *mtp); +uint64_t memstat_get_kegfree(const struct memory_type *mtp); +uint64_t memstat_get_percpu_memalloced(const struct memory_type *mtp, + int cpu); +uint64_t memstat_get_percpu_memfreed(const struct memory_type *mtp, + int cpu); +uint64_t memstat_get_percpu_numallocs(const struct memory_type *mtp, + int cpu); +uint64_t memstat_get_percpu_numfrees(const struct memory_type *mtp, + int cpu); +uint64_t memstat_get_percpu_sizemask(const struct memory_type *mtp, + int cpu); +void *memstat_get_percpu_caller_pointer( + const struct memory_type *mtp, int cpu, int index); +void memstat_set_percpu_caller_pointer(struct memory_type *mtp, + int cpu, int index, void *value); +uint64_t memstat_get_percpu_caller_uint64( + const struct memory_type *mtp, int cpu, int index); +void memstat_set_percpu_caller_uint64(struct memory_type *mtp, + int cpu, int index, uint64_t value); +uint64_t memstat_get_percpu_free(const struct memory_type *mtp, + int cpu); +__END_DECLS + +#endif /* !_MEMSTAT_H_ */ diff --git a/src/include.new/menu.h b/src/include.new/menu.h new file mode 100644 index 0000000..8c12894 --- /dev/null +++ b/src/include.new/menu.h @@ -0,0 +1,254 @@ +/**************************************************************************** + * Copyright (c) 1998,2000 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Juergen Pfeifer 1995,1997 * + ****************************************************************************/ + +#ifndef ETI_MENU +#define ETI_MENU + +#ifdef AMIGA +#define TEXT TEXT_ncurses +#endif + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef int Menu_Options; +typedef int Item_Options; + +/* Menu options: */ +#define O_ONEVALUE (0x01) +#define O_SHOWDESC (0x02) +#define O_ROWMAJOR (0x04) +#define O_IGNORECASE (0x08) +#define O_SHOWMATCH (0x10) +#define O_NONCYCLIC (0x20) + +/* Item options: */ +#define O_SELECTABLE (0x01) + +typedef struct +{ + const char* str; + unsigned short length; +} TEXT; + +typedef struct tagITEM +{ + TEXT name; /* name of menu item */ + TEXT description; /* description of item, optional in display */ + struct tagMENU *imenu; /* Pointer to parent menu */ + void *userptr; /* Pointer to user defined per item data */ + Item_Options opt; /* Item options */ + short index; /* Item number if connected to a menu */ + short y; /* y and x location of item in menu */ + short x; + bool value; /* Selection value */ + + struct tagITEM *left; /* neighbour items */ + struct tagITEM *right; + struct tagITEM *up; + struct tagITEM *down; + +} ITEM; + +typedef void (*Menu_Hook)(struct tagMENU *); + +typedef struct tagMENU +{ + short height; /* Nr. of chars high */ + short width; /* Nr. of chars wide */ + short rows; /* Nr. of items high */ + short cols; /* Nr. of items wide */ + short frows; /* Nr. of formatted items high */ + short fcols; /* Nr. of formatted items wide */ + short arows; /* Nr. of items high (actual) */ + short namelen; /* Max. name length */ + short desclen; /* Max. description length */ + short marklen; /* Length of mark, if any */ + short itemlen; /* Length of one item */ + short spc_desc; /* Spacing for descriptor */ + short spc_cols; /* Spacing for columns */ + short spc_rows; /* Spacing for rows */ + char *pattern; /* Buffer to store match chars */ + short pindex; /* Index into pattern buffer */ + WINDOW *win; /* Window containing menu */ + WINDOW *sub; /* Subwindow for menu display */ + WINDOW *userwin; /* User's window */ + WINDOW *usersub; /* User's subwindow */ + ITEM **items; /* array of items */ + short nitems; /* Nr. of items in menu */ + ITEM *curitem; /* Current item */ + short toprow; /* Top row of menu */ + chtype fore; /* Selection attribute */ + chtype back; /* Nonselection attribute */ + chtype grey; /* Inactive attribute */ + unsigned char pad; /* Pad character */ + + Menu_Hook menuinit; /* User hooks */ + Menu_Hook menuterm; + Menu_Hook iteminit; + Menu_Hook itemterm; + + void *userptr; /* Pointer to menus user data */ + char *mark; /* Pointer to marker string */ + + Menu_Options opt; /* Menu options */ + unsigned short status; /* Internal state of menu */ + +} MENU; + + +/* Define keys */ + +#define REQ_LEFT_ITEM (KEY_MAX + 1) +#define REQ_RIGHT_ITEM (KEY_MAX + 2) +#define REQ_UP_ITEM (KEY_MAX + 3) +#define REQ_DOWN_ITEM (KEY_MAX + 4) +#define REQ_SCR_ULINE (KEY_MAX + 5) +#define REQ_SCR_DLINE (KEY_MAX + 6) +#define REQ_SCR_DPAGE (KEY_MAX + 7) +#define REQ_SCR_UPAGE (KEY_MAX + 8) +#define REQ_FIRST_ITEM (KEY_MAX + 9) +#define REQ_LAST_ITEM (KEY_MAX + 10) +#define REQ_NEXT_ITEM (KEY_MAX + 11) +#define REQ_PREV_ITEM (KEY_MAX + 12) +#define REQ_TOGGLE_ITEM (KEY_MAX + 13) +#define REQ_CLEAR_PATTERN (KEY_MAX + 14) +#define REQ_BACK_PATTERN (KEY_MAX + 15) +#define REQ_NEXT_MATCH (KEY_MAX + 16) +#define REQ_PREV_MATCH (KEY_MAX + 17) + +#define MIN_MENU_COMMAND (KEY_MAX + 1) +#define MAX_MENU_COMMAND (KEY_MAX + 17) + +/* + * Some AT&T code expects MAX_COMMAND to be out-of-band not + * just for menu commands but for forms ones as well. + */ +#if defined(MAX_COMMAND) +# if (MAX_MENU_COMMAND > MAX_COMMAND) +# error Something is wrong -- MAX_MENU_COMMAND is greater than MAX_COMMAND +# elif (MAX_COMMAND != (KEY_MAX + 128)) +# error Something is wrong -- MAX_COMMAND is already inconsistently defined. +# endif +#else +# define MAX_COMMAND (KEY_MAX + 128) +#endif + + +/* --------- prototypes for libmenu functions ----------------------------- */ + +extern NCURSES_EXPORT(ITEM **) menu_items (const MENU *); +extern NCURSES_EXPORT(ITEM *) current_item (const MENU *); +extern NCURSES_EXPORT(ITEM *) new_item (const char *,const char *); + +extern NCURSES_EXPORT(MENU *) new_menu (ITEM **); + +extern NCURSES_EXPORT(Item_Options) item_opts (const ITEM *); +extern NCURSES_EXPORT(Menu_Options) menu_opts (const MENU *); + +extern NCURSES_EXPORT(Menu_Hook) item_init (const MENU *); +extern NCURSES_EXPORT(Menu_Hook) item_term (const MENU *); +extern NCURSES_EXPORT(Menu_Hook) menu_init (const MENU *); +extern NCURSES_EXPORT(Menu_Hook) menu_term (const MENU *); + +extern NCURSES_EXPORT(WINDOW *) menu_sub (const MENU *); +extern NCURSES_EXPORT(WINDOW *) menu_win (const MENU *); + +extern NCURSES_EXPORT(const char *) item_description (const ITEM *); +extern NCURSES_EXPORT(const char *) item_name (const ITEM *); +extern NCURSES_EXPORT(const char *) menu_mark (const MENU *); +extern NCURSES_EXPORT(const char *) menu_request_name (int); + +extern NCURSES_EXPORT(char *) menu_pattern (const MENU *); + +extern NCURSES_EXPORT(void *) menu_userptr (const MENU *); +extern NCURSES_EXPORT(void *) item_userptr (const ITEM *); + +extern NCURSES_EXPORT(chtype) menu_back (const MENU *); +extern NCURSES_EXPORT(chtype) menu_fore (const MENU *); +extern NCURSES_EXPORT(chtype) menu_grey (const MENU *); + +extern NCURSES_EXPORT(int) free_item (ITEM *); +extern NCURSES_EXPORT(int) free_menu (MENU *); +extern NCURSES_EXPORT(int) item_count (const MENU *); +extern NCURSES_EXPORT(int) item_index (const ITEM *); +extern NCURSES_EXPORT(int) item_opts_off (ITEM *,Item_Options); +extern NCURSES_EXPORT(int) item_opts_on (ITEM *,Item_Options); +extern NCURSES_EXPORT(int) menu_driver (MENU *,int); +extern NCURSES_EXPORT(int) menu_opts_off (MENU *,Menu_Options); +extern NCURSES_EXPORT(int) menu_opts_on (MENU *,Menu_Options); +extern NCURSES_EXPORT(int) menu_pad (const MENU *); +extern NCURSES_EXPORT(int) pos_menu_cursor (const MENU *); +extern NCURSES_EXPORT(int) post_menu (MENU *); +extern NCURSES_EXPORT(int) scale_menu (const MENU *,int *,int *); +extern NCURSES_EXPORT(int) set_current_item (MENU *menu,ITEM *item); +extern NCURSES_EXPORT(int) set_item_init (MENU *,void(*)(MENU *)); +extern NCURSES_EXPORT(int) set_item_opts (ITEM *,Item_Options); +extern NCURSES_EXPORT(int) set_item_term (MENU *,void(*)(MENU *)); +extern NCURSES_EXPORT(int) set_item_userptr (ITEM *, void *); +extern NCURSES_EXPORT(int) set_item_value (ITEM *,bool); +extern NCURSES_EXPORT(int) set_menu_back (MENU *,chtype); +extern NCURSES_EXPORT(int) set_menu_fore (MENU *,chtype); +extern NCURSES_EXPORT(int) set_menu_format (MENU *,int,int); +extern NCURSES_EXPORT(int) set_menu_grey (MENU *,chtype); +extern NCURSES_EXPORT(int) set_menu_init (MENU *,void(*)(MENU *)); +extern NCURSES_EXPORT(int) set_menu_items (MENU *,ITEM **); +extern NCURSES_EXPORT(int) set_menu_mark (MENU *, const char *); +extern NCURSES_EXPORT(int) set_menu_opts (MENU *,Menu_Options); +extern NCURSES_EXPORT(int) set_menu_pad (MENU *,int); +extern NCURSES_EXPORT(int) set_menu_pattern (MENU *,const char *); +extern NCURSES_EXPORT(int) set_menu_sub (MENU *,WINDOW *); +extern NCURSES_EXPORT(int) set_menu_term (MENU *,void(*)(MENU *)); +extern NCURSES_EXPORT(int) set_menu_userptr (MENU *,void *); +extern NCURSES_EXPORT(int) set_menu_win (MENU *,WINDOW *); +extern NCURSES_EXPORT(int) set_top_row (MENU *,int); +extern NCURSES_EXPORT(int) top_row (const MENU *); +extern NCURSES_EXPORT(int) unpost_menu (MENU *); +extern NCURSES_EXPORT(int) menu_request_by_name (const char *); +extern NCURSES_EXPORT(int) set_menu_spacing (MENU *,int,int,int); +extern NCURSES_EXPORT(int) menu_spacing (const MENU *,int *,int *,int *); + + +extern NCURSES_EXPORT(bool) item_value (const ITEM *); +extern NCURSES_EXPORT(bool) item_visible (const ITEM *); + +extern NCURSES_EXPORT(void) menu_format (const MENU *,int *,int *); + +#ifdef __cplusplus + } +#endif + +#endif /* ETI_MENU */ diff --git a/src/include.new/mmintrin.h b/src/include.new/mmintrin.h new file mode 100644 index 0000000..bd775e8 --- /dev/null +++ b/src/include.new/mmintrin.h @@ -0,0 +1,917 @@ +/* Copyright (C) 2002, 2003 Free Software Foundation, Inc. + + This file is part of GCC. + + GCC is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + GCC is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with GCC; see the file COPYING. If not, write to + the Free Software Foundation, 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +/* As a special exception, if you include this header file into source + files compiled by GCC, this header file does not by itself cause + the resulting executable to be covered by the GNU General Public + License. This exception does not however invalidate any other + reasons why the executable file might be covered by the GNU General + Public License. */ + +/* Implemented from the specification included in the Intel C++ Compiler + User Guide and Reference, version 8.0. */ + +#ifndef _MMINTRIN_H_INCLUDED +#define _MMINTRIN_H_INCLUDED + +#ifndef __MMX__ +# error "MMX instruction set not enabled" +#else +/* The data type intended for user use. */ +typedef int __m64 __attribute__ ((__mode__ (__V2SI__))); + +/* Internal data types for implementing the intrinsics. */ +typedef int __v2si __attribute__ ((__mode__ (__V2SI__))); +typedef int __v4hi __attribute__ ((__mode__ (__V4HI__))); +typedef int __v8qi __attribute__ ((__mode__ (__V8QI__))); + +/* Empty the multimedia state. */ +static __inline void +_mm_empty (void) +{ + __builtin_ia32_emms (); +} + +static __inline void +_m_empty (void) +{ + _mm_empty (); +} + +/* Convert I to a __m64 object. The integer is zero-extended to 64-bits. */ +static __inline __m64 +_mm_cvtsi32_si64 (int __i) +{ + long long __tmp = (unsigned int)__i; + return (__m64) __tmp; +} + +static __inline __m64 +_m_from_int (int __i) +{ + return _mm_cvtsi32_si64 (__i); +} + +#ifdef __x86_64__ +/* Convert I to a __m64 object. */ +static __inline __m64 +_mm_cvtsi64x_si64 (long long __i) +{ + return (__m64) __i; +} + +/* Convert I to a __m64 object. */ +static __inline __m64 +_mm_set_pi64x (long long __i) +{ + return (__m64) __i; +} +#endif + +/* Convert the lower 32 bits of the __m64 object into an integer. */ +static __inline int +_mm_cvtsi64_si32 (__m64 __i) +{ + long long __tmp = (long long)__i; + return __tmp; +} + +static __inline int +_m_to_int (__m64 __i) +{ + return _mm_cvtsi64_si32 (__i); +} + +#ifdef __x86_64__ +/* Convert the lower 32 bits of the __m64 object into an integer. */ +static __inline long long +_mm_cvtsi64_si64x (__m64 __i) +{ + return (long long)__i; +} +#endif + +/* Pack the four 16-bit values from M1 into the lower four 8-bit values of + the result, and the four 16-bit values from M2 into the upper four 8-bit + values of the result, all with signed saturation. */ +static __inline __m64 +_mm_packs_pi16 (__m64 __m1, __m64 __m2) +{ + return (__m64) __builtin_ia32_packsswb ((__v4hi)__m1, (__v4hi)__m2); +} + +static __inline __m64 +_m_packsswb (__m64 __m1, __m64 __m2) +{ + return _mm_packs_pi16 (__m1, __m2); +} + +/* Pack the two 32-bit values from M1 in to the lower two 16-bit values of + the result, and the two 32-bit values from M2 into the upper two 16-bit + values of the result, all with signed saturation. */ +static __inline __m64 +_mm_packs_pi32 (__m64 __m1, __m64 __m2) +{ + return (__m64) __builtin_ia32_packssdw ((__v2si)__m1, (__v2si)__m2); +} + +static __inline __m64 +_m_packssdw (__m64 __m1, __m64 __m2) +{ + return _mm_packs_pi32 (__m1, __m2); +} + +/* Pack the four 16-bit values from M1 into the lower four 8-bit values of + the result, and the four 16-bit values from M2 into the upper four 8-bit + values of the result, all with unsigned saturation. */ +static __inline __m64 +_mm_packs_pu16 (__m64 __m1, __m64 __m2) +{ + return (__m64) __builtin_ia32_packuswb ((__v4hi)__m1, (__v4hi)__m2); +} + +static __inline __m64 +_m_packuswb (__m64 __m1, __m64 __m2) +{ + return _mm_packs_pu16 (__m1, __m2); +} + +/* Interleave the four 8-bit values from the high half of M1 with the four + 8-bit values from the high half of M2. */ +static __inline __m64 +_mm_unpackhi_pi8 (__m64 __m1, __m64 __m2) +{ + return (__m64) __builtin_ia32_punpckhbw ((__v8qi)__m1, (__v8qi)__m2); +} + +static __inline __m64 +_m_punpckhbw (__m64 __m1, __m64 __m2) +{ + return _mm_unpackhi_pi8 (__m1, __m2); +} + +/* Interleave the two 16-bit values from the high half of M1 with the two + 16-bit values from the high half of M2. */ +static __inline __m64 +_mm_unpackhi_pi16 (__m64 __m1, __m64 __m2) +{ + return (__m64) __builtin_ia32_punpckhwd ((__v4hi)__m1, (__v4hi)__m2); +} + +static __inline __m64 +_m_punpckhwd (__m64 __m1, __m64 __m2) +{ + return _mm_unpackhi_pi16 (__m1, __m2); +} + +/* Interleave the 32-bit value from the high half of M1 with the 32-bit + value from the high half of M2. */ +static __inline __m64 +_mm_unpackhi_pi32 (__m64 __m1, __m64 __m2) +{ + return (__m64) __builtin_ia32_punpckhdq ((__v2si)__m1, (__v2si)__m2); +} + +static __inline __m64 +_m_punpckhdq (__m64 __m1, __m64 __m2) +{ + return _mm_unpackhi_pi32 (__m1, __m2); +} + +/* Interleave the four 8-bit values from the low half of M1 with the four + 8-bit values from the low half of M2. */ +static __inline __m64 +_mm_unpacklo_pi8 (__m64 __m1, __m64 __m2) +{ + return (__m64) __builtin_ia32_punpcklbw ((__v8qi)__m1, (__v8qi)__m2); +} + +static __inline __m64 +_m_punpcklbw (__m64 __m1, __m64 __m2) +{ + return _mm_unpacklo_pi8 (__m1, __m2); +} + +/* Interleave the two 16-bit values from the low half of M1 with the two + 16-bit values from the low half of M2. */ +static __inline __m64 +_mm_unpacklo_pi16 (__m64 __m1, __m64 __m2) +{ + return (__m64) __builtin_ia32_punpcklwd ((__v4hi)__m1, (__v4hi)__m2); +} + +static __inline __m64 +_m_punpcklwd (__m64 __m1, __m64 __m2) +{ + return _mm_unpacklo_pi16 (__m1, __m2); +} + +/* Interleave the 32-bit value from the low half of M1 with the 32-bit + value from the low half of M2. */ +static __inline __m64 +_mm_unpacklo_pi32 (__m64 __m1, __m64 __m2) +{ + return (__m64) __builtin_ia32_punpckldq ((__v2si)__m1, (__v2si)__m2); +} + +static __inline __m64 +_m_punpckldq (__m64 __m1, __m64 __m2) +{ + return _mm_unpacklo_pi32 (__m1, __m2); +} + +/* Add the 8-bit values in M1 to the 8-bit values in M2. */ +static __inline __m64 +_mm_add_pi8 (__m64 __m1, __m64 __m2) +{ + return (__m64) __builtin_ia32_paddb ((__v8qi)__m1, (__v8qi)__m2); +} + +static __inline __m64 +_m_paddb (__m64 __m1, __m64 __m2) +{ + return _mm_add_pi8 (__m1, __m2); +} + +/* Add the 16-bit values in M1 to the 16-bit values in M2. */ +static __inline __m64 +_mm_add_pi16 (__m64 __m1, __m64 __m2) +{ + return (__m64) __builtin_ia32_paddw ((__v4hi)__m1, (__v4hi)__m2); +} + +static __inline __m64 +_m_paddw (__m64 __m1, __m64 __m2) +{ + return _mm_add_pi16 (__m1, __m2); +} + +/* Add the 32-bit values in M1 to the 32-bit values in M2. */ +static __inline __m64 +_mm_add_pi32 (__m64 __m1, __m64 __m2) +{ + return (__m64) __builtin_ia32_paddd ((__v2si)__m1, (__v2si)__m2); +} + +static __inline __m64 +_m_paddd (__m64 __m1, __m64 __m2) +{ + return _mm_add_pi32 (__m1, __m2); +} + +/* Add the 64-bit values in M1 to the 64-bit values in M2. */ +static __inline __m64 +_mm_add_si64 (__m64 __m1, __m64 __m2) +{ + return (__m64) __builtin_ia32_paddq ((long long)__m1, (long long)__m2); +} + +/* Add the 8-bit values in M1 to the 8-bit values in M2 using signed + saturated arithmetic. */ +static __inline __m64 +_mm_adds_pi8 (__m64 __m1, __m64 __m2) +{ + return (__m64) __builtin_ia32_paddsb ((__v8qi)__m1, (__v8qi)__m2); +} + +static __inline __m64 +_m_paddsb (__m64 __m1, __m64 __m2) +{ + return _mm_adds_pi8 (__m1, __m2); +} + +/* Add the 16-bit values in M1 to the 16-bit values in M2 using signed + saturated arithmetic. */ +static __inline __m64 +_mm_adds_pi16 (__m64 __m1, __m64 __m2) +{ + return (__m64) __builtin_ia32_paddsw ((__v4hi)__m1, (__v4hi)__m2); +} + +static __inline __m64 +_m_paddsw (__m64 __m1, __m64 __m2) +{ + return _mm_adds_pi16 (__m1, __m2); +} + +/* Add the 8-bit values in M1 to the 8-bit values in M2 using unsigned + saturated arithmetic. */ +static __inline __m64 +_mm_adds_pu8 (__m64 __m1, __m64 __m2) +{ + return (__m64) __builtin_ia32_paddusb ((__v8qi)__m1, (__v8qi)__m2); +} + +static __inline __m64 +_m_paddusb (__m64 __m1, __m64 __m2) +{ + return _mm_adds_pu8 (__m1, __m2); +} + +/* Add the 16-bit values in M1 to the 16-bit values in M2 using unsigned + saturated arithmetic. */ +static __inline __m64 +_mm_adds_pu16 (__m64 __m1, __m64 __m2) +{ + return (__m64) __builtin_ia32_paddusw ((__v4hi)__m1, (__v4hi)__m2); +} + +static __inline __m64 +_m_paddusw (__m64 __m1, __m64 __m2) +{ + return _mm_adds_pu16 (__m1, __m2); +} + +/* Subtract the 8-bit values in M2 from the 8-bit values in M1. */ +static __inline __m64 +_mm_sub_pi8 (__m64 __m1, __m64 __m2) +{ + return (__m64) __builtin_ia32_psubb ((__v8qi)__m1, (__v8qi)__m2); +} + +static __inline __m64 +_m_psubb (__m64 __m1, __m64 __m2) +{ + return _mm_sub_pi8 (__m1, __m2); +} + +/* Subtract the 16-bit values in M2 from the 16-bit values in M1. */ +static __inline __m64 +_mm_sub_pi16 (__m64 __m1, __m64 __m2) +{ + return (__m64) __builtin_ia32_psubw ((__v4hi)__m1, (__v4hi)__m2); +} + +static __inline __m64 +_m_psubw (__m64 __m1, __m64 __m2) +{ + return _mm_sub_pi16 (__m1, __m2); +} + +/* Subtract the 32-bit values in M2 from the 32-bit values in M1. */ +static __inline __m64 +_mm_sub_pi32 (__m64 __m1, __m64 __m2) +{ + return (__m64) __builtin_ia32_psubd ((__v2si)__m1, (__v2si)__m2); +} + +static __inline __m64 +_m_psubd (__m64 __m1, __m64 __m2) +{ + return _mm_sub_pi32 (__m1, __m2); +} + +/* Add the 64-bit values in M1 to the 64-bit values in M2. */ +static __inline __m64 +_mm_sub_si64 (__m64 __m1, __m64 __m2) +{ + return (__m64) __builtin_ia32_psubq ((long long)__m1, (long long)__m2); +} + +/* Subtract the 8-bit values in M2 from the 8-bit values in M1 using signed + saturating arithmetic. */ +static __inline __m64 +_mm_subs_pi8 (__m64 __m1, __m64 __m2) +{ + return (__m64) __builtin_ia32_psubsb ((__v8qi)__m1, (__v8qi)__m2); +} + +static __inline __m64 +_m_psubsb (__m64 __m1, __m64 __m2) +{ + return _mm_subs_pi8 (__m1, __m2); +} + +/* Subtract the 16-bit values in M2 from the 16-bit values in M1 using + signed saturating arithmetic. */ +static __inline __m64 +_mm_subs_pi16 (__m64 __m1, __m64 __m2) +{ + return (__m64) __builtin_ia32_psubsw ((__v4hi)__m1, (__v4hi)__m2); +} + +static __inline __m64 +_m_psubsw (__m64 __m1, __m64 __m2) +{ + return _mm_subs_pi16 (__m1, __m2); +} + +/* Subtract the 8-bit values in M2 from the 8-bit values in M1 using + unsigned saturating arithmetic. */ +static __inline __m64 +_mm_subs_pu8 (__m64 __m1, __m64 __m2) +{ + return (__m64) __builtin_ia32_psubusb ((__v8qi)__m1, (__v8qi)__m2); +} + +static __inline __m64 +_m_psubusb (__m64 __m1, __m64 __m2) +{ + return _mm_subs_pu8 (__m1, __m2); +} + +/* Subtract the 16-bit values in M2 from the 16-bit values in M1 using + unsigned saturating arithmetic. */ +static __inline __m64 +_mm_subs_pu16 (__m64 __m1, __m64 __m2) +{ + return (__m64) __builtin_ia32_psubusw ((__v4hi)__m1, (__v4hi)__m2); +} + +static __inline __m64 +_m_psubusw (__m64 __m1, __m64 __m2) +{ + return _mm_subs_pu16 (__m1, __m2); +} + +/* Multiply four 16-bit values in M1 by four 16-bit values in M2 producing + four 32-bit intermediate results, which are then summed by pairs to + produce two 32-bit results. */ +static __inline __m64 +_mm_madd_pi16 (__m64 __m1, __m64 __m2) +{ + return (__m64) __builtin_ia32_pmaddwd ((__v4hi)__m1, (__v4hi)__m2); +} + +static __inline __m64 +_m_pmaddwd (__m64 __m1, __m64 __m2) +{ + return _mm_madd_pi16 (__m1, __m2); +} + +/* Multiply four signed 16-bit values in M1 by four signed 16-bit values in + M2 and produce the high 16 bits of the 32-bit results. */ +static __inline __m64 +_mm_mulhi_pi16 (__m64 __m1, __m64 __m2) +{ + return (__m64) __builtin_ia32_pmulhw ((__v4hi)__m1, (__v4hi)__m2); +} + +static __inline __m64 +_m_pmulhw (__m64 __m1, __m64 __m2) +{ + return _mm_mulhi_pi16 (__m1, __m2); +} + +/* Multiply four 16-bit values in M1 by four 16-bit values in M2 and produce + the low 16 bits of the results. */ +static __inline __m64 +_mm_mullo_pi16 (__m64 __m1, __m64 __m2) +{ + return (__m64) __builtin_ia32_pmullw ((__v4hi)__m1, (__v4hi)__m2); +} + +static __inline __m64 +_m_pmullw (__m64 __m1, __m64 __m2) +{ + return _mm_mullo_pi16 (__m1, __m2); +} + +/* Shift four 16-bit values in M left by COUNT. */ +static __inline __m64 +_mm_sll_pi16 (__m64 __m, __m64 __count) +{ + return (__m64) __builtin_ia32_psllw ((__v4hi)__m, (long long)__count); +} + +static __inline __m64 +_m_psllw (__m64 __m, __m64 __count) +{ + return _mm_sll_pi16 (__m, __count); +} + +static __inline __m64 +_mm_slli_pi16 (__m64 __m, int __count) +{ + return (__m64) __builtin_ia32_psllw ((__v4hi)__m, __count); +} + +static __inline __m64 +_m_psllwi (__m64 __m, int __count) +{ + return _mm_slli_pi16 (__m, __count); +} + +/* Shift two 32-bit values in M left by COUNT. */ +static __inline __m64 +_mm_sll_pi32 (__m64 __m, __m64 __count) +{ + return (__m64) __builtin_ia32_pslld ((__v2si)__m, (long long)__count); +} + +static __inline __m64 +_m_pslld (__m64 __m, __m64 __count) +{ + return _mm_sll_pi32 (__m, __count); +} + +static __inline __m64 +_mm_slli_pi32 (__m64 __m, int __count) +{ + return (__m64) __builtin_ia32_pslld ((__v2si)__m, __count); +} + +static __inline __m64 +_m_pslldi (__m64 __m, int __count) +{ + return _mm_slli_pi32 (__m, __count); +} + +/* Shift the 64-bit value in M left by COUNT. */ +static __inline __m64 +_mm_sll_si64 (__m64 __m, __m64 __count) +{ + return (__m64) __builtin_ia32_psllq ((long long)__m, (long long)__count); +} + +static __inline __m64 +_m_psllq (__m64 __m, __m64 __count) +{ + return _mm_sll_si64 (__m, __count); +} + +static __inline __m64 +_mm_slli_si64 (__m64 __m, int __count) +{ + return (__m64) __builtin_ia32_psllq ((long long)__m, (long long)__count); +} + +static __inline __m64 +_m_psllqi (__m64 __m, int __count) +{ + return _mm_slli_si64 (__m, __count); +} + +/* Shift four 16-bit values in M right by COUNT; shift in the sign bit. */ +static __inline __m64 +_mm_sra_pi16 (__m64 __m, __m64 __count) +{ + return (__m64) __builtin_ia32_psraw ((__v4hi)__m, (long long)__count); +} + +static __inline __m64 +_m_psraw (__m64 __m, __m64 __count) +{ + return _mm_sra_pi16 (__m, __count); +} + +static __inline __m64 +_mm_srai_pi16 (__m64 __m, int __count) +{ + return (__m64) __builtin_ia32_psraw ((__v4hi)__m, __count); +} + +static __inline __m64 +_m_psrawi (__m64 __m, int __count) +{ + return _mm_srai_pi16 (__m, __count); +} + +/* Shift two 32-bit values in M right by COUNT; shift in the sign bit. */ +static __inline __m64 +_mm_sra_pi32 (__m64 __m, __m64 __count) +{ + return (__m64) __builtin_ia32_psrad ((__v2si)__m, (long long)__count); +} + +static __inline __m64 +_m_psrad (__m64 __m, __m64 __count) +{ + return _mm_sra_pi32 (__m, __count); +} + +static __inline __m64 +_mm_srai_pi32 (__m64 __m, int __count) +{ + return (__m64) __builtin_ia32_psrad ((__v2si)__m, __count); +} + +static __inline __m64 +_m_psradi (__m64 __m, int __count) +{ + return _mm_srai_pi32 (__m, __count); +} + +/* Shift four 16-bit values in M right by COUNT; shift in zeros. */ +static __inline __m64 +_mm_srl_pi16 (__m64 __m, __m64 __count) +{ + return (__m64) __builtin_ia32_psrlw ((__v4hi)__m, (long long)__count); +} + +static __inline __m64 +_m_psrlw (__m64 __m, __m64 __count) +{ + return _mm_srl_pi16 (__m, __count); +} + +static __inline __m64 +_mm_srli_pi16 (__m64 __m, int __count) +{ + return (__m64) __builtin_ia32_psrlw ((__v4hi)__m, __count); +} + +static __inline __m64 +_m_psrlwi (__m64 __m, int __count) +{ + return _mm_srli_pi16 (__m, __count); +} + +/* Shift two 32-bit values in M right by COUNT; shift in zeros. */ +static __inline __m64 +_mm_srl_pi32 (__m64 __m, __m64 __count) +{ + return (__m64) __builtin_ia32_psrld ((__v2si)__m, (long long)__count); +} + +static __inline __m64 +_m_psrld (__m64 __m, __m64 __count) +{ + return _mm_srl_pi32 (__m, __count); +} + +static __inline __m64 +_mm_srli_pi32 (__m64 __m, int __count) +{ + return (__m64) __builtin_ia32_psrld ((__v2si)__m, __count); +} + +static __inline __m64 +_m_psrldi (__m64 __m, int __count) +{ + return _mm_srli_pi32 (__m, __count); +} + +/* Shift the 64-bit value in M left by COUNT; shift in zeros. */ +static __inline __m64 +_mm_srl_si64 (__m64 __m, __m64 __count) +{ + return (__m64) __builtin_ia32_psrlq ((long long)__m, (long long)__count); +} + +static __inline __m64 +_m_psrlq (__m64 __m, __m64 __count) +{ + return _mm_srl_si64 (__m, __count); +} + +static __inline __m64 +_mm_srli_si64 (__m64 __m, int __count) +{ + return (__m64) __builtin_ia32_psrlq ((long long)__m, (long long)__count); +} + +static __inline __m64 +_m_psrlqi (__m64 __m, int __count) +{ + return _mm_srli_si64 (__m, __count); +} + +/* Bit-wise AND the 64-bit values in M1 and M2. */ +static __inline __m64 +_mm_and_si64 (__m64 __m1, __m64 __m2) +{ + return (__m64) __builtin_ia32_pand ((long long)__m1, (long long)__m2); +} + +static __inline __m64 +_m_pand (__m64 __m1, __m64 __m2) +{ + return _mm_and_si64 (__m1, __m2); +} + +/* Bit-wise complement the 64-bit value in M1 and bit-wise AND it with the + 64-bit value in M2. */ +static __inline __m64 +_mm_andnot_si64 (__m64 __m1, __m64 __m2) +{ + return (__m64) __builtin_ia32_pandn ((long long)__m1, (long long)__m2); +} + +static __inline __m64 +_m_pandn (__m64 __m1, __m64 __m2) +{ + return _mm_andnot_si64 (__m1, __m2); +} + +/* Bit-wise inclusive OR the 64-bit values in M1 and M2. */ +static __inline __m64 +_mm_or_si64 (__m64 __m1, __m64 __m2) +{ + return (__m64)__builtin_ia32_por ((long long)__m1, (long long)__m2); +} + +static __inline __m64 +_m_por (__m64 __m1, __m64 __m2) +{ + return _mm_or_si64 (__m1, __m2); +} + +/* Bit-wise exclusive OR the 64-bit values in M1 and M2. */ +static __inline __m64 +_mm_xor_si64 (__m64 __m1, __m64 __m2) +{ + return (__m64)__builtin_ia32_pxor ((long long)__m1, (long long)__m2); +} + +static __inline __m64 +_m_pxor (__m64 __m1, __m64 __m2) +{ + return _mm_xor_si64 (__m1, __m2); +} + +/* Compare eight 8-bit values. The result of the comparison is 0xFF if the + test is true and zero if false. */ +static __inline __m64 +_mm_cmpeq_pi8 (__m64 __m1, __m64 __m2) +{ + return (__m64) __builtin_ia32_pcmpeqb ((__v8qi)__m1, (__v8qi)__m2); +} + +static __inline __m64 +_m_pcmpeqb (__m64 __m1, __m64 __m2) +{ + return _mm_cmpeq_pi8 (__m1, __m2); +} + +static __inline __m64 +_mm_cmpgt_pi8 (__m64 __m1, __m64 __m2) +{ + return (__m64) __builtin_ia32_pcmpgtb ((__v8qi)__m1, (__v8qi)__m2); +} + +static __inline __m64 +_m_pcmpgtb (__m64 __m1, __m64 __m2) +{ + return _mm_cmpgt_pi8 (__m1, __m2); +} + +/* Compare four 16-bit values. The result of the comparison is 0xFFFF if + the test is true and zero if false. */ +static __inline __m64 +_mm_cmpeq_pi16 (__m64 __m1, __m64 __m2) +{ + return (__m64) __builtin_ia32_pcmpeqw ((__v4hi)__m1, (__v4hi)__m2); +} + +static __inline __m64 +_m_pcmpeqw (__m64 __m1, __m64 __m2) +{ + return _mm_cmpeq_pi16 (__m1, __m2); +} + +static __inline __m64 +_mm_cmpgt_pi16 (__m64 __m1, __m64 __m2) +{ + return (__m64) __builtin_ia32_pcmpgtw ((__v4hi)__m1, (__v4hi)__m2); +} + +static __inline __m64 +_m_pcmpgtw (__m64 __m1, __m64 __m2) +{ + return _mm_cmpgt_pi16 (__m1, __m2); +} + +/* Compare two 32-bit values. The result of the comparison is 0xFFFFFFFF if + the test is true and zero if false. */ +static __inline __m64 +_mm_cmpeq_pi32 (__m64 __m1, __m64 __m2) +{ + return (__m64) __builtin_ia32_pcmpeqd ((__v2si)__m1, (__v2si)__m2); +} + +static __inline __m64 +_m_pcmpeqd (__m64 __m1, __m64 __m2) +{ + return _mm_cmpeq_pi32 (__m1, __m2); +} + +static __inline __m64 +_mm_cmpgt_pi32 (__m64 __m1, __m64 __m2) +{ + return (__m64) __builtin_ia32_pcmpgtd ((__v2si)__m1, (__v2si)__m2); +} + +static __inline __m64 +_m_pcmpgtd (__m64 __m1, __m64 __m2) +{ + return _mm_cmpgt_pi32 (__m1, __m2); +} + +/* Creates a 64-bit zero. */ +static __inline __m64 +_mm_setzero_si64 (void) +{ + return (__m64)__builtin_ia32_mmx_zero (); +} + +/* Creates a vector of two 32-bit values; I0 is least significant. */ +static __inline __m64 +_mm_set_pi32 (int __i1, int __i0) +{ + union { + __m64 __q; + struct { + unsigned int __i0; + unsigned int __i1; + } __s; + } __u; + + __u.__s.__i0 = __i0; + __u.__s.__i1 = __i1; + + return __u.__q; +} + +/* Creates a vector of four 16-bit values; W0 is least significant. */ +static __inline __m64 +_mm_set_pi16 (short __w3, short __w2, short __w1, short __w0) +{ + unsigned int __i1 = (unsigned short)__w3 << 16 | (unsigned short)__w2; + unsigned int __i0 = (unsigned short)__w1 << 16 | (unsigned short)__w0; + return _mm_set_pi32 (__i1, __i0); + +} + +/* Creates a vector of eight 8-bit values; B0 is least significant. */ +static __inline __m64 +_mm_set_pi8 (char __b7, char __b6, char __b5, char __b4, + char __b3, char __b2, char __b1, char __b0) +{ + unsigned int __i1, __i0; + + __i1 = (unsigned char)__b7; + __i1 = __i1 << 8 | (unsigned char)__b6; + __i1 = __i1 << 8 | (unsigned char)__b5; + __i1 = __i1 << 8 | (unsigned char)__b4; + + __i0 = (unsigned char)__b3; + __i0 = __i0 << 8 | (unsigned char)__b2; + __i0 = __i0 << 8 | (unsigned char)__b1; + __i0 = __i0 << 8 | (unsigned char)__b0; + + return _mm_set_pi32 (__i1, __i0); +} + +/* Similar, but with the arguments in reverse order. */ +static __inline __m64 +_mm_setr_pi32 (int __i0, int __i1) +{ + return _mm_set_pi32 (__i1, __i0); +} + +static __inline __m64 +_mm_setr_pi16 (short __w0, short __w1, short __w2, short __w3) +{ + return _mm_set_pi16 (__w3, __w2, __w1, __w0); +} + +static __inline __m64 +_mm_setr_pi8 (char __b0, char __b1, char __b2, char __b3, + char __b4, char __b5, char __b6, char __b7) +{ + return _mm_set_pi8 (__b7, __b6, __b5, __b4, __b3, __b2, __b1, __b0); +} + +/* Creates a vector of two 32-bit values, both elements containing I. */ +static __inline __m64 +_mm_set1_pi32 (int __i) +{ + return _mm_set_pi32 (__i, __i); +} + +/* Creates a vector of four 16-bit values, all elements containing W. */ +static __inline __m64 +_mm_set1_pi16 (short __w) +{ + unsigned int __i = (unsigned short)__w << 16 | (unsigned short)__w; + return _mm_set1_pi32 (__i); +} + +/* Creates a vector of eight 8-bit values, all elements containing B. */ +static __inline __m64 +_mm_set1_pi8 (char __b) +{ + unsigned int __w = (unsigned char)__b << 8 | (unsigned char)__b; + unsigned int __i = __w << 16 | __w; + return _mm_set1_pi32 (__i); +} + +#endif /* __MMX__ */ +#endif /* _MMINTRIN_H_INCLUDED */ diff --git a/src/include.new/monetary.h b/src/include.new/monetary.h new file mode 100644 index 0000000..4d4c69d --- /dev/null +++ b/src/include.new/monetary.h @@ -0,0 +1,49 @@ +/*- + * Copyright (c) 2001 Alexey Zelkin + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD: src/include/monetary.h,v 1.7 2002/09/20 08:22:48 mike Exp $ + */ + +#ifndef _MONETARY_H_ +#define _MONETARY_H_ + +#include +#include + +#ifndef _SIZE_T_DECLARED +typedef __size_t size_t; +#define _SIZE_T_DECLARED +#endif + +#ifndef _SSIZE_T_DECLARED +typedef __ssize_t ssize_t; +#define _SSIZE_T_DECLARED +#endif + +__BEGIN_DECLS +ssize_t strfmon(char * __restrict, size_t, const char * __restrict, ...); +__END_DECLS + +#endif /* !_MONETARY_H_ */ diff --git a/src/include.new/mp.h b/src/include.new/mp.h new file mode 100644 index 0000000..dbe5023 --- /dev/null +++ b/src/include.new/mp.h @@ -0,0 +1,32 @@ +/* $FreeBSD: src/lib/libmp/mp.h,v 1.2 2003/01/28 23:03:15 markm Exp $ */ + +#ifndef _MP_H_ +#define _MP_H_ + +#ifndef HEADER_BN_H_ +#include +#endif + +typedef struct _mint { + BIGNUM *bn; +} MINT; + +void gcd(const MINT *, const MINT *, MINT *); +MINT *itom(short); +void madd(const MINT *, const MINT *, MINT *); +int mcmp(const MINT *, const MINT *); +void mdiv(const MINT *, const MINT *, MINT *, MINT *); +void mfree(MINT *); +void min(MINT *); +void mout(const MINT *); +void move(const MINT *, MINT *); +void msqrt(const MINT *, MINT *, MINT *); +void msub(const MINT *, const MINT *, MINT *); +char *mtox(const MINT *); +void mult(const MINT *, const MINT *, MINT *); +void pow(const MINT *, const MINT *, const MINT *, MINT *); +void rpow(const MINT *, short, MINT *); +void sdiv(const MINT *, short, MINT *, short *); +MINT *xtom(const char *); + +#endif /* !_MP_H_ */ diff --git a/src/include.new/mpool.h b/src/include.new/mpool.h new file mode 100644 index 0000000..8342ca1 --- /dev/null +++ b/src/include.new/mpool.h @@ -0,0 +1,105 @@ +/*- + * Copyright (c) 1991, 1993, 1994 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)mpool.h 8.2 (Berkeley) 7/14/94 + * $FreeBSD: src/include/mpool.h,v 1.9 2002/03/23 17:24:53 imp Exp $ + */ + +#ifndef _MPOOL_H_ +#define _MPOOL_H_ + +#include + +/* + * The memory pool scheme is a simple one. Each in-memory page is referenced + * by a bucket which is threaded in up to two of three ways. All active pages + * are threaded on a hash chain (hashed by page number) and an lru chain. + * Inactive pages are threaded on a free chain. Each reference to a memory + * pool is handed an opaque MPOOL cookie which stores all of this information. + */ +#define HASHSIZE 128 +#define HASHKEY(pgno) ((pgno - 1) % HASHSIZE) + +/* The BKT structures are the elements of the queues. */ +typedef struct _bkt { + TAILQ_ENTRY(_bkt) hq; /* hash queue */ + TAILQ_ENTRY(_bkt) q; /* lru queue */ + void *page; /* page */ + pgno_t pgno; /* page number */ + +#define MPOOL_DIRTY 0x01 /* page needs to be written */ +#define MPOOL_PINNED 0x02 /* page is pinned into memory */ + u_int8_t flags; /* flags */ +} BKT; + +typedef struct MPOOL { + TAILQ_HEAD(_lqh, _bkt) lqh; /* lru queue head */ + /* hash queue array */ + TAILQ_HEAD(_hqh, _bkt) hqh[HASHSIZE]; + pgno_t curcache; /* current number of cached pages */ + pgno_t maxcache; /* max number of cached pages */ + pgno_t npages; /* number of pages in the file */ + u_long pagesize; /* file page size */ + int fd; /* file descriptor */ + /* page in conversion routine */ + void (*pgin)(void *, pgno_t, void *); + /* page out conversion routine */ + void (*pgout)(void *, pgno_t, void *); + void *pgcookie; /* cookie for page in/out routines */ +#ifdef STATISTICS + u_long cachehit; + u_long cachemiss; + u_long pagealloc; + u_long pageflush; + u_long pageget; + u_long pagenew; + u_long pageput; + u_long pageread; + u_long pagewrite; +#endif +} MPOOL; + +__BEGIN_DECLS +MPOOL *mpool_open(void *, int, pgno_t, pgno_t); +void mpool_filter(MPOOL *, void (*)(void *, pgno_t, void *), + void (*)(void *, pgno_t, void *), void *); +void *mpool_new(MPOOL *, pgno_t *); +void *mpool_get(MPOOL *, pgno_t, u_int); +int mpool_put(MPOOL *, void *, u_int); +int mpool_sync(MPOOL *); +int mpool_close(MPOOL *); +#ifdef STATISTICS +void mpool_stat(MPOOL *); +#endif +__END_DECLS + +#endif diff --git a/src/include.new/ncurses.h b/src/include.new/ncurses.h new file mode 100644 index 0000000..059fc5f --- /dev/null +++ b/src/include.new/ncurses.h @@ -0,0 +1,1194 @@ +/**************************************************************************** + * Copyright (c) 1998-2001,2002 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + * and: Thomas E. Dickey 1996-on * + ****************************************************************************/ + +/* $Id$ */ + +#ifndef __NCURSES_H +#define __NCURSES_H + +#define CURSES 1 +#define CURSES_H 1 + +/* This should be defined for the enhanced functionality to be visible. + * However, none of the wide-character (enhanced) functionality is implemented. + * So we do not define it (yet). +#define _XOPEN_CURSES 1 + */ + +/* These are defined only in curses.h, and are used for conditional compiles */ +#define NCURSES_VERSION_MAJOR 5 +#define NCURSES_VERSION_MINOR 2 +#define NCURSES_VERSION_PATCH 20020615 + +/* This is defined in more than one ncurses header, for identification */ +#undef NCURSES_VERSION +#define NCURSES_VERSION "5.2" + +#include + +#ifdef NCURSES_NOMACROS +#define NCURSES_ATTR_T attr_t +#endif + +#ifndef NCURSES_ATTR_T +#define NCURSES_ATTR_T int +#endif + +#undef NCURSES_CONST +#define NCURSES_CONST const + +#undef NCURSES_COLOR_T +#define NCURSES_COLOR_T short + +#undef NCURSES_SIZE_T +#define NCURSES_SIZE_T short + +#undef NCURSES_CH_T +#define NCURSES_CH_T chtype + +typedef unsigned long chtype; + +#include +#include +#include /* we need va_list */ +#ifdef _XOPEN_SOURCE_EXTENDED +#include /* we want wchar_t */ +#endif /* _XOPEN_SOURCE_EXTENDED */ + +/* XSI and SVr4 specify that curses implements 'bool'. However, C++ may also + * implement it. If so, we must use the C++ compiler's type to avoid conflict + * with other interfaces. + * + * A further complication is that may declare 'bool' to be a + * different type, such as an enum which is not necessarily compatible with + * C++. If we have , make 'bool' a macro, so users may #undef it. + * Otherwise, let it remain a typedef to avoid conflicts with other #define's. + * In either case, make a typedef for NCURSES_BOOL which can be used if needed + * from either C or C++. + */ + +#undef TRUE +#define TRUE 1 + +#undef FALSE +#define FALSE 0 + +typedef unsigned char NCURSES_BOOL; + +#if (!defined(__cplusplus) || !1) && (!0) + +#if 1 +#include +#endif + +#undef bool + +#if 1 +#define bool NCURSES_BOOL +#else +typedef unsigned char bool; +#endif + +#endif /* !__cplusplus, etc. */ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * XSI attributes. In the ncurses implementation, they are identical to the + * A_ attributes. + */ +#define WA_ATTRIBUTES A_ATTRIBUTES +#define WA_NORMAL A_NORMAL +#define WA_STANDOUT A_STANDOUT +#define WA_UNDERLINE A_UNDERLINE +#define WA_REVERSE A_REVERSE +#define WA_BLINK A_BLINK +#define WA_DIM A_DIM +#define WA_BOLD A_BOLD +#define WA_ALTCHARSET A_ALTCHARSET +#define WA_INVIS A_INVIS +#define WA_PROTECT A_PROTECT +#define WA_HORIZONTAL A_HORIZONTAL +#define WA_LEFT A_LEFT +#define WA_LOW A_LOW +#define WA_RIGHT A_RIGHT +#define WA_TOP A_TOP +#define WA_VERTICAL A_VERTICAL + +/* colors */ +extern NCURSES_EXPORT_VAR(int) COLORS; +extern NCURSES_EXPORT_VAR(int) COLOR_PAIRS; + +#define COLOR_BLACK 0 +#define COLOR_RED 1 +#define COLOR_GREEN 2 +#define COLOR_YELLOW 3 +#define COLOR_BLUE 4 +#define COLOR_MAGENTA 5 +#define COLOR_CYAN 6 +#define COLOR_WHITE 7 + +/* line graphics */ + +#if 0 +extern NCURSES_EXPORT_VAR(chtype*) _nc_acs_map(void); +#define acs_map (_nc_acs_map()) +#else +extern NCURSES_EXPORT_VAR(chtype) acs_map[]; +#endif + +/* VT100 symbols begin here */ +#define ACS_ULCORNER (acs_map['l']) /* upper left corner */ +#define ACS_LLCORNER (acs_map['m']) /* lower left corner */ +#define ACS_URCORNER (acs_map['k']) /* upper right corner */ +#define ACS_LRCORNER (acs_map['j']) /* lower right corner */ +#define ACS_LTEE (acs_map['t']) /* tee pointing right */ +#define ACS_RTEE (acs_map['u']) /* tee pointing left */ +#define ACS_BTEE (acs_map['v']) /* tee pointing up */ +#define ACS_TTEE (acs_map['w']) /* tee pointing down */ +#define ACS_HLINE (acs_map['q']) /* horizontal line */ +#define ACS_VLINE (acs_map['x']) /* vertical line */ +#define ACS_PLUS (acs_map['n']) /* large plus or crossover */ +#define ACS_S1 (acs_map['o']) /* scan line 1 */ +#define ACS_S9 (acs_map['s']) /* scan line 9 */ +#define ACS_DIAMOND (acs_map['`']) /* diamond */ +#define ACS_CKBOARD (acs_map['a']) /* checker board (stipple) */ +#define ACS_DEGREE (acs_map['f']) /* degree symbol */ +#define ACS_PLMINUS (acs_map['g']) /* plus/minus */ +#define ACS_BULLET (acs_map['~']) /* bullet */ +/* Teletype 5410v1 symbols begin here */ +#define ACS_LARROW (acs_map[',']) /* arrow pointing left */ +#define ACS_RARROW (acs_map['+']) /* arrow pointing right */ +#define ACS_DARROW (acs_map['.']) /* arrow pointing down */ +#define ACS_UARROW (acs_map['-']) /* arrow pointing up */ +#define ACS_BOARD (acs_map['h']) /* board of squares */ +#define ACS_LANTERN (acs_map['i']) /* lantern symbol */ +#define ACS_BLOCK (acs_map['0']) /* solid square block */ +/* + * These aren't documented, but a lot of System Vs have them anyway + * (you can spot pprryyzz{{||}} in a lot of AT&T terminfo strings). + * The ACS_names may not match AT&T's, our source didn't know them. + */ +#define ACS_S3 (acs_map['p']) /* scan line 3 */ +#define ACS_S7 (acs_map['r']) /* scan line 7 */ +#define ACS_LEQUAL (acs_map['y']) /* less/equal */ +#define ACS_GEQUAL (acs_map['z']) /* greater/equal */ +#define ACS_PI (acs_map['{']) /* Pi */ +#define ACS_NEQUAL (acs_map['|']) /* not equal */ +#define ACS_STERLING (acs_map['}']) /* UK pound sign */ + +/* + * Line drawing ACS names are of the form ACS_trbl, where t is the top, r + * is the right, b is the bottom, and l is the left. t, r, b, and l might + * be B (blank), S (single), D (double), or T (thick). The subset defined + * here only uses B and S. + */ +#define ACS_BSSB ACS_ULCORNER +#define ACS_SSBB ACS_LLCORNER +#define ACS_BBSS ACS_URCORNER +#define ACS_SBBS ACS_LRCORNER +#define ACS_SBSS ACS_RTEE +#define ACS_SSSB ACS_LTEE +#define ACS_SSBS ACS_BTEE +#define ACS_BSSS ACS_TTEE +#define ACS_BSBS ACS_HLINE +#define ACS_SBSB ACS_VLINE +#define ACS_SSSS ACS_PLUS + +#if defined(ERR) && ((ERR) != -1) +#undef ERR +#endif + +#if !defined(ERR) +#define ERR (-1) +#endif + +#if defined(OK) && ((OK) != 0) +#undef OK +#endif + +#if !defined(OK) +#define OK (0) +#endif + +/* values for the _flags member */ +#define _SUBWIN 0x01 /* is this a sub-window? */ +#define _ENDLINE 0x02 /* is the window flush right? */ +#define _FULLWIN 0x04 /* is the window full-screen? */ +#define _SCROLLWIN 0x08 /* bottom edge is at screen bottom? */ +#define _ISPAD 0x10 /* is this window a pad? */ +#define _HASMOVED 0x20 /* has cursor moved since last refresh? */ +#define _WRAPPED 0x40 /* cursor was just wrappped */ + +/* + * this value is used in the firstchar and lastchar fields to mark + * unchanged lines + */ +#define _NOCHANGE -1 + +/* + * this value is used in the oldindex field to mark lines created by insertions + * and scrolls. + */ +#define _NEWINDEX -1 + +typedef struct screen SCREEN; +typedef struct _win_st WINDOW; + +typedef chtype attr_t; /* ...must be at least as wide as chtype */ + +#ifdef _XOPEN_SOURCE_EXTENDED + +#if 0 +#ifdef mblen /* libutf8.h defines it w/o undefining first */ +#undef mblen +#endif +#include +#define __wchar_t +#define __wint_t +#endif + +#if 0 +#include /* ...to get mbstate_t, etc. */ +#endif + +#ifndef __wchar_t +typedef unsigned long wchar_t; +#endif /* __wchar_t */ +#ifndef __wint_t +typedef long int wint_t; +#endif /* __wint_t */ + +#define CCHARW_MAX 5 +typedef struct +{ + attr_t attr; + wchar_t chars[CCHARW_MAX]; +} +cchar_t; + +#endif /* _XOPEN_SOURCE_EXTENDED */ + +struct ldat; + +struct _win_st +{ + NCURSES_SIZE_T _cury, _curx; /* current cursor position */ + + /* window location and size */ + NCURSES_SIZE_T _maxy, _maxx; /* maximums of x and y, NOT window size */ + NCURSES_SIZE_T _begy, _begx; /* screen coords of upper-left-hand corner */ + + short _flags; /* window state flags */ + + /* attribute tracking */ + attr_t _attrs; /* current attribute for non-space character */ + chtype _bkgd; /* current background char/attribute pair */ + + /* option values set by user */ + bool _notimeout; /* no time out on function-key entry? */ + bool _clear; /* consider all data in the window invalid? */ + bool _leaveok; /* OK to not reset cursor on exit? */ + bool _scroll; /* OK to scroll this window? */ + bool _idlok; /* OK to use insert/delete line? */ + bool _idcok; /* OK to use insert/delete char? */ + bool _immed; /* window in immed mode? (not yet used) */ + bool _sync; /* window in sync mode? */ + bool _use_keypad; /* process function keys into KEY_ symbols? */ + int _delay; /* 0 = nodelay, <0 = blocking, >0 = delay */ + + struct ldat *_line; /* the actual line data */ + + /* global screen state */ + NCURSES_SIZE_T _regtop; /* top line of scrolling region */ + NCURSES_SIZE_T _regbottom; /* bottom line of scrolling region */ + + /* these are used only if this is a sub-window */ + int _parx; /* x coordinate of this window in parent */ + int _pary; /* y coordinate of this window in parent */ + WINDOW *_parent; /* pointer to parent if a sub-window */ + + /* these are used only if this is a pad */ + struct pdat + { + NCURSES_SIZE_T _pad_y, _pad_x; + NCURSES_SIZE_T _pad_top, _pad_left; + NCURSES_SIZE_T _pad_bottom, _pad_right; + } _pad; + + NCURSES_SIZE_T _yoffset; /* real begy is _begy + _yoffset */ + +#ifdef _XOPEN_SOURCE_EXTENDED + cchar_t _bkgrnd; /* current background char/attribute pair */ +#endif +}; + +extern NCURSES_EXPORT_VAR(WINDOW *) stdscr; +extern NCURSES_EXPORT_VAR(WINDOW *) curscr; +extern NCURSES_EXPORT_VAR(WINDOW *) newscr; + +extern NCURSES_EXPORT_VAR(int) LINES; +extern NCURSES_EXPORT_VAR(int) COLS; +extern NCURSES_EXPORT_VAR(int) TABSIZE; + +/* + * This global was an undocumented feature under AIX curses. + */ +extern NCURSES_EXPORT_VAR(int) ESCDELAY; /* ESC expire time in milliseconds */ + +extern NCURSES_EXPORT_VAR(char) ttytype[]; /* needed for backward compatibility */ + +/* + * These functions are extensions - not in XSI Curses. + */ +#if 1 +extern NCURSES_EXPORT(bool) is_term_resized (int, int); +extern NCURSES_EXPORT(char *) keybound (int, int); +extern NCURSES_EXPORT(const char *) curses_version (void); +extern NCURSES_EXPORT(int) assume_default_colors (int, int); +extern NCURSES_EXPORT(int) define_key (char *, int); +extern NCURSES_EXPORT(int) keyok (int, bool); +extern NCURSES_EXPORT(int) resize_term (int, int); +extern NCURSES_EXPORT(int) resizeterm (int, int); +extern NCURSES_EXPORT(int) use_default_colors (void); +extern NCURSES_EXPORT(int) use_extended_names (bool); +extern NCURSES_EXPORT(int) wresize (WINDOW *, int, int); +#else +#define curses_version() NCURSES_VERSION +#endif + +/* + * GCC (and some other compilers) define '__attribute__'; we're using this + * macro to alert the compiler to flag inconsistencies in printf/scanf-like + * function calls. Just in case '__attribute__' isn't defined, make a dummy. + * G++ doesn't accept it anyway. + */ +#if !defined(__GNUC__) && !defined(__attribute__) +#define __attribute__(p) /* nothing */ +#endif + +/* + * For g++, turn off our macros that use __attribute__ (g++ recognizes some + * of them, but not at the same version levels as gcc). + */ +#ifdef __cplusplus +#undef GCC_NORETURN +#undef GCC_PRINTF +#undef GCC_SCANF +#undef GCC_UNUSED +#endif + +/* + * We cannot define these in ncurses_cfg.h, since they require parameters to be + * passed (that's non-portable). + */ +#ifndef GCC_PRINTFLIKE +#if defined(GCC_PRINTF) && !defined(printf) +#define GCC_PRINTFLIKE(fmt,var) __attribute__((format(printf,fmt,var))) +#else +#define GCC_PRINTFLIKE(fmt,var) /*nothing*/ +#endif +#endif + +#ifndef GCC_SCANFLIKE +#if defined(GCC_SCANF) && !defined(scanf) +#define GCC_SCANFLIKE(fmt,var) __attribute__((format(scanf,fmt,var))) +#else +#define GCC_SCANFLIKE(fmt,var) /*nothing*/ +#endif +#endif + +#ifndef GCC_NORETURN +#define GCC_NORETURN /* nothing */ +#endif + +#ifndef GCC_UNUSED +#define GCC_UNUSED /* nothing */ +#endif + +/* + * Function prototypes. This is the complete XSI Curses list of required + * functions. Those marked `generated' will have sources generated from the + * macro definitions later in this file, in order to satisfy XPG4.2 + * requirements. + */ + +extern NCURSES_EXPORT(int) addch (const chtype); /* generated */ +extern NCURSES_EXPORT(int) addchnstr (const chtype *, int); /* generated */ +extern NCURSES_EXPORT(int) addchstr (const chtype *); /* generated */ +extern NCURSES_EXPORT(int) addnstr (const char *, int); /* generated */ +extern NCURSES_EXPORT(int) addstr (const char *); /* generated */ +extern NCURSES_EXPORT(int) attroff (NCURSES_ATTR_T); /* generated */ +extern NCURSES_EXPORT(int) attron (NCURSES_ATTR_T); /* generated */ +extern NCURSES_EXPORT(int) attrset (NCURSES_ATTR_T); /* generated */ +extern NCURSES_EXPORT(int) attr_get (attr_t *, short *, void *); /* generated */ +extern NCURSES_EXPORT(int) attr_off (attr_t, void *); /* generated */ +extern NCURSES_EXPORT(int) attr_on (attr_t, void *); /* generated */ +extern NCURSES_EXPORT(int) attr_set (attr_t, short, void *); /* generated */ +extern NCURSES_EXPORT(int) baudrate (void); /* implemented */ +extern NCURSES_EXPORT(int) beep (void); /* implemented */ +extern NCURSES_EXPORT(int) bkgd (chtype); /* generated */ +extern NCURSES_EXPORT(void) bkgdset (chtype); /* generated */ +extern NCURSES_EXPORT(int) border (chtype,chtype,chtype,chtype,chtype,chtype,chtype,chtype); /* generated */ +extern NCURSES_EXPORT(int) box (WINDOW *, chtype, chtype); /* generated */ +extern NCURSES_EXPORT(bool) can_change_color (void); /* implemented */ +extern NCURSES_EXPORT(int) cbreak (void); /* implemented */ +extern NCURSES_EXPORT(int) chgat (int, attr_t, short, const void *); /* generated */ +extern NCURSES_EXPORT(int) clear (void); /* generated */ +extern NCURSES_EXPORT(int) clearok (WINDOW *,bool); /* implemented */ +extern NCURSES_EXPORT(int) clrtobot (void); /* generated */ +extern NCURSES_EXPORT(int) clrtoeol (void); /* generated */ +extern NCURSES_EXPORT(int) color_content (short,short*,short*,short*); /* implemented */ +extern NCURSES_EXPORT(int) color_set (short,void*); /* generated */ +extern NCURSES_EXPORT(int) COLOR_PAIR (int); /* generated */ +extern NCURSES_EXPORT(int) copywin (const WINDOW*,WINDOW*,int,int,int,int,int,int,int); /* implemented */ +extern NCURSES_EXPORT(int) curs_set (int); /* implemented */ +extern NCURSES_EXPORT(int) def_prog_mode (void); /* implemented */ +extern NCURSES_EXPORT(int) def_shell_mode (void); /* implemented */ +extern NCURSES_EXPORT(int) delay_output (int); /* implemented */ +extern NCURSES_EXPORT(int) delch (void); /* generated */ +extern NCURSES_EXPORT(void) delscreen (SCREEN *); /* implemented */ +extern NCURSES_EXPORT(int) delwin (WINDOW *); /* implemented */ +extern NCURSES_EXPORT(int) deleteln (void); /* generated */ +extern NCURSES_EXPORT(WINDOW *) derwin (WINDOW *,int,int,int,int); /* implemented */ +extern NCURSES_EXPORT(int) doupdate (void); /* implemented */ +extern NCURSES_EXPORT(WINDOW *) dupwin (WINDOW *); /* implemented */ +extern NCURSES_EXPORT(int) echo (void); /* implemented */ +extern NCURSES_EXPORT(int) echochar (const chtype); /* generated */ +extern NCURSES_EXPORT(int) erase (void); /* generated */ +extern NCURSES_EXPORT(int) endwin (void); /* implemented */ +extern NCURSES_EXPORT(char) erasechar (void); /* implemented */ +extern NCURSES_EXPORT(void) filter (void); /* implemented */ +extern NCURSES_EXPORT(int) flash (void); /* implemented */ +extern NCURSES_EXPORT(int) flushinp (void); /* implemented */ +extern NCURSES_EXPORT(chtype) getbkgd (WINDOW *); /* generated */ +extern NCURSES_EXPORT(int) getch (void); /* generated */ +extern NCURSES_EXPORT(int) getnstr (char *, int); /* generated */ +extern NCURSES_EXPORT(int) getstr (char *); /* generated */ +extern NCURSES_EXPORT(WINDOW *) getwin (FILE *); /* implemented */ +extern NCURSES_EXPORT(int) halfdelay (int); /* implemented */ +extern NCURSES_EXPORT(bool) has_colors (void); /* implemented */ +extern NCURSES_EXPORT(bool) has_ic (void); /* implemented */ +extern NCURSES_EXPORT(bool) has_il (void); /* implemented */ +extern NCURSES_EXPORT(int) hline (chtype, int); /* generated */ +extern NCURSES_EXPORT(void) idcok (WINDOW *, bool); /* implemented */ +extern NCURSES_EXPORT(int) idlok (WINDOW *, bool); /* implemented */ +extern NCURSES_EXPORT(void) immedok (WINDOW *, bool); /* implemented */ +extern NCURSES_EXPORT(chtype) inch (void); /* generated */ +extern NCURSES_EXPORT(int) inchnstr (chtype *, int); /* generated */ +extern NCURSES_EXPORT(int) inchstr (chtype *); /* generated */ +extern NCURSES_EXPORT(WINDOW *) initscr (void); /* implemented */ +extern NCURSES_EXPORT(int) init_color (short,short,short,short); /* implemented */ +extern NCURSES_EXPORT(int) init_pair (short,short,short); /* implemented */ +extern NCURSES_EXPORT(int) innstr (char *, int); /* generated */ +extern NCURSES_EXPORT(int) insch (chtype); /* generated */ +extern NCURSES_EXPORT(int) insdelln (int); /* generated */ +extern NCURSES_EXPORT(int) insertln (void); /* generated */ +extern NCURSES_EXPORT(int) insnstr (const char *, int); /* generated */ +extern NCURSES_EXPORT(int) insstr (const char *); /* generated */ +extern NCURSES_EXPORT(int) instr (char *); /* generated */ +extern NCURSES_EXPORT(int) intrflush (WINDOW *,bool); /* implemented */ +extern NCURSES_EXPORT(bool) isendwin (void); /* implemented */ +extern NCURSES_EXPORT(bool) is_linetouched (WINDOW *,int); /* implemented */ +extern NCURSES_EXPORT(bool) is_wintouched (WINDOW *); /* implemented */ +extern NCURSES_EXPORT(NCURSES_CONST char *) keyname (int); /* implemented */ +extern NCURSES_EXPORT(int) keypad (WINDOW *,bool); /* implemented */ +extern NCURSES_EXPORT(char) killchar (void); /* implemented */ +extern NCURSES_EXPORT(int) leaveok (WINDOW *,bool); /* implemented */ +extern NCURSES_EXPORT(char *) longname (void); /* implemented */ +extern NCURSES_EXPORT(int) meta (WINDOW *,bool); /* implemented */ +extern NCURSES_EXPORT(int) move (int, int); /* generated */ +extern NCURSES_EXPORT(int) mvaddch (int, int, const chtype); /* generated */ +extern NCURSES_EXPORT(int) mvaddchnstr (int, int, const chtype *, int); /* generated */ +extern NCURSES_EXPORT(int) mvaddchstr (int, int, const chtype *); /* generated */ +extern NCURSES_EXPORT(int) mvaddnstr (int, int, const char *, int); /* generated */ +extern NCURSES_EXPORT(int) mvaddstr (int, int, const char *); /* generated */ +extern NCURSES_EXPORT(int) mvchgat (int, int, int, attr_t, short, const void *); /* generated */ +extern NCURSES_EXPORT(int) mvcur (int,int,int,int); /* implemented */ +extern NCURSES_EXPORT(int) mvdelch (int, int); /* generated */ +extern NCURSES_EXPORT(int) mvderwin (WINDOW *, int, int); /* implemented */ +extern NCURSES_EXPORT(int) mvgetch (int, int); /* generated */ +extern NCURSES_EXPORT(int) mvgetnstr (int, int, char *, int); /* generated */ +extern NCURSES_EXPORT(int) mvgetstr (int, int, char *); /* generated */ +extern NCURSES_EXPORT(int) mvhline (int, int, chtype, int); /* generated */ +extern NCURSES_EXPORT(chtype) mvinch (int, int); /* generated */ +extern NCURSES_EXPORT(int) mvinchnstr (int, int, chtype *, int); /* generated */ +extern NCURSES_EXPORT(int) mvinchstr (int, int, chtype *); /* generated */ +extern NCURSES_EXPORT(int) mvinnstr (int, int, char *, int); /* generated */ +extern NCURSES_EXPORT(int) mvinsch (int, int, chtype); /* generated */ +extern NCURSES_EXPORT(int) mvinsnstr (int, int, const char *, int); /* generated */ +extern NCURSES_EXPORT(int) mvinsstr (int, int, const char *); /* generated */ +extern NCURSES_EXPORT(int) mvinstr (int, int, char *); /* generated */ +extern NCURSES_EXPORT(int) mvprintw (int,int, NCURSES_CONST char *,...) /* implemented */ + GCC_PRINTFLIKE(3,4); +extern NCURSES_EXPORT(int) mvscanw (int,int, NCURSES_CONST char *,...) /* implemented */ + GCC_SCANFLIKE(3,4); +extern NCURSES_EXPORT(int) mvvline (int, int, chtype, int); /* generated */ +extern NCURSES_EXPORT(int) mvwaddch (WINDOW *, int, int, const chtype); /* generated */ +extern NCURSES_EXPORT(int) mvwaddchnstr (WINDOW *, int, int, const chtype *, int);/* generated */ +extern NCURSES_EXPORT(int) mvwaddchstr (WINDOW *, int, int, const chtype *); /* generated */ +extern NCURSES_EXPORT(int) mvwaddnstr (WINDOW *, int, int, const char *, int); /* generated */ +extern NCURSES_EXPORT(int) mvwaddstr (WINDOW *, int, int, const char *); /* generated */ +extern NCURSES_EXPORT(int) mvwchgat (WINDOW *, int, int, int, attr_t, short, const void *);/* generated */ +extern NCURSES_EXPORT(int) mvwdelch (WINDOW *, int, int); /* generated */ +extern NCURSES_EXPORT(int) mvwgetch (WINDOW *, int, int); /* generated */ +extern NCURSES_EXPORT(int) mvwgetnstr (WINDOW *, int, int, char *, int); /* generated */ +extern NCURSES_EXPORT(int) mvwgetstr (WINDOW *, int, int, char *); /* generated */ +extern NCURSES_EXPORT(int) mvwhline (WINDOW *, int, int, chtype, int); /* generated */ +extern NCURSES_EXPORT(int) mvwin (WINDOW *,int,int); /* implemented */ +extern NCURSES_EXPORT(chtype) mvwinch (WINDOW *, int, int); /* generated */ +extern NCURSES_EXPORT(int) mvwinchnstr (WINDOW *, int, int, chtype *, int); /* generated */ +extern NCURSES_EXPORT(int) mvwinchstr (WINDOW *, int, int, chtype *); /* generated */ +extern NCURSES_EXPORT(int) mvwinnstr (WINDOW *, int, int, char *, int); /* generated */ +extern NCURSES_EXPORT(int) mvwinsch (WINDOW *, int, int, chtype); /* generated */ +extern NCURSES_EXPORT(int) mvwinsnstr (WINDOW *, int, int, const char *, int); /* generated */ +extern NCURSES_EXPORT(int) mvwinsstr (WINDOW *, int, int, const char *); /* generated */ +extern NCURSES_EXPORT(int) mvwinstr (WINDOW *, int, int, char *); /* generated */ +extern NCURSES_EXPORT(int) mvwprintw (WINDOW*,int,int, NCURSES_CONST char *,...) /* implemented */ + GCC_PRINTFLIKE(4,5); +extern NCURSES_EXPORT(int) mvwscanw (WINDOW *,int,int, NCURSES_CONST char *,...) /* implemented */ + GCC_SCANFLIKE(4,5); +extern NCURSES_EXPORT(int) mvwvline (WINDOW *,int, int, chtype, int); /* generated */ +extern NCURSES_EXPORT(int) napms (int); /* implemented */ +extern NCURSES_EXPORT(WINDOW *) newpad (int,int); /* implemented */ +extern NCURSES_EXPORT(SCREEN *) newterm (NCURSES_CONST char *,FILE *,FILE *); /* implemented */ +extern NCURSES_EXPORT(WINDOW *) newwin (int,int,int,int); /* implemented */ +extern NCURSES_EXPORT(int) nl (void); /* implemented */ +extern NCURSES_EXPORT(int) nocbreak (void); /* implemented */ +extern NCURSES_EXPORT(int) nodelay (WINDOW *,bool); /* implemented */ +extern NCURSES_EXPORT(int) noecho (void); /* implemented */ +extern NCURSES_EXPORT(int) nonl (void); /* implemented */ +extern NCURSES_EXPORT(void) noqiflush (void); /* implemented */ +extern NCURSES_EXPORT(int) noraw (void); /* implemented */ +extern NCURSES_EXPORT(int) notimeout (WINDOW *,bool); /* implemented */ +extern NCURSES_EXPORT(int) overlay (const WINDOW*,WINDOW *); /* implemented */ +extern NCURSES_EXPORT(int) overwrite (const WINDOW*,WINDOW *); /* implemented */ +extern NCURSES_EXPORT(int) pair_content (short,short*,short*); /* implemented */ +extern NCURSES_EXPORT(int) PAIR_NUMBER (int); /* generated */ +extern NCURSES_EXPORT(int) pechochar (WINDOW *, const chtype); /* implemented */ +extern NCURSES_EXPORT(int) pnoutrefresh (WINDOW*,int,int,int,int,int,int);/* implemented */ +extern NCURSES_EXPORT(int) prefresh (WINDOW *,int,int,int,int,int,int); /* implemented */ +extern NCURSES_EXPORT(int) printw (NCURSES_CONST char *,...) /* implemented */ + GCC_PRINTFLIKE(1,2); +extern NCURSES_EXPORT(int) putp (const char *); /* implemented */ +extern NCURSES_EXPORT(int) putwin (WINDOW *, FILE *); /* implemented */ +extern NCURSES_EXPORT(void) qiflush (void); /* implemented */ +extern NCURSES_EXPORT(int) raw (void); /* implemented */ +extern NCURSES_EXPORT(int) redrawwin (WINDOW *); /* generated */ +extern NCURSES_EXPORT(int) refresh (void); /* generated */ +extern NCURSES_EXPORT(int) resetty (void); /* implemented */ +extern NCURSES_EXPORT(int) reset_prog_mode (void); /* implemented */ +extern NCURSES_EXPORT(int) reset_shell_mode (void); /* implemented */ +extern NCURSES_EXPORT(int) ripoffline (int, int (*)(WINDOW *, int)); /* implemented */ +extern NCURSES_EXPORT(int) savetty (void); /* implemented */ +extern NCURSES_EXPORT(int) scanw (NCURSES_CONST char *,...) /* implemented */ + GCC_SCANFLIKE(1,2); +extern NCURSES_EXPORT(int) scr_dump (const char *); /* implemented */ +extern NCURSES_EXPORT(int) scr_init (const char *); /* implemented */ +extern NCURSES_EXPORT(int) scrl (int); /* generated */ +extern NCURSES_EXPORT(int) scroll (WINDOW *); /* generated */ +extern NCURSES_EXPORT(int) scrollok (WINDOW *,bool); /* implemented */ +extern NCURSES_EXPORT(int) scr_restore (const char *); /* implemented */ +extern NCURSES_EXPORT(int) scr_set (const char *); /* implemented */ +extern NCURSES_EXPORT(int) setscrreg (int,int); /* generated */ +extern NCURSES_EXPORT(SCREEN *) set_term (SCREEN *); /* implemented */ +extern NCURSES_EXPORT(int) slk_attroff (const chtype); /* implemented */ +extern NCURSES_EXPORT(int) slk_attr_off (const attr_t, void *); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) slk_attron (const chtype); /* implemented */ +extern NCURSES_EXPORT(int) slk_attr_on (attr_t,void*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) slk_attrset (const chtype); /* implemented */ +extern NCURSES_EXPORT(attr_t) slk_attr (void); /* implemented */ +extern NCURSES_EXPORT(int) slk_attr_set (const attr_t,short,void*); /* implemented */ +extern NCURSES_EXPORT(int) slk_clear (void); /* implemented */ +extern NCURSES_EXPORT(int) slk_color (short); /* implemented */ +extern NCURSES_EXPORT(int) slk_init (int); /* implemented */ +extern NCURSES_EXPORT(char *) slk_label (int); /* implemented */ +extern NCURSES_EXPORT(int) slk_noutrefresh (void); /* implemented */ +extern NCURSES_EXPORT(int) slk_refresh (void); /* implemented */ +extern NCURSES_EXPORT(int) slk_restore (void); /* implemented */ +extern NCURSES_EXPORT(int) slk_set (int,const char *,int); /* implemented */ +extern NCURSES_EXPORT(int) slk_touch (void); /* implemented */ +extern NCURSES_EXPORT(int) standout (void); /* generated */ +extern NCURSES_EXPORT(int) standend (void); /* generated */ +extern NCURSES_EXPORT(int) start_color (void); /* implemented */ +extern NCURSES_EXPORT(WINDOW *) subpad (WINDOW *, int, int, int, int); /* implemented */ +extern NCURSES_EXPORT(WINDOW *) subwin (WINDOW *,int,int,int,int); /* implemented */ +extern NCURSES_EXPORT(int) syncok (WINDOW *, bool); /* implemented */ +extern NCURSES_EXPORT(chtype) termattrs (void); /* implemented */ +extern NCURSES_EXPORT(char *) termname (void); /* implemented */ +extern NCURSES_EXPORT(int) tigetflag (NCURSES_CONST char *); /* implemented */ +extern NCURSES_EXPORT(int) tigetnum (NCURSES_CONST char *); /* implemented */ +extern NCURSES_EXPORT(char *) tigetstr (NCURSES_CONST char *); /* implemented */ +extern NCURSES_EXPORT(void) timeout (int); /* generated */ +extern NCURSES_EXPORT(int) touchline (WINDOW *, int, int); /* generated */ +extern NCURSES_EXPORT(int) touchwin (WINDOW *); /* generated */ +extern NCURSES_EXPORT(char *) tparm (NCURSES_CONST char *, ...); /* implemented */ +extern NCURSES_EXPORT(int) typeahead (int); /* implemented */ +extern NCURSES_EXPORT(int) ungetch (int); /* implemented */ +extern NCURSES_EXPORT(int) untouchwin (WINDOW *); /* generated */ +extern NCURSES_EXPORT(void) use_env (bool); /* implemented */ +extern NCURSES_EXPORT(int) vidattr (chtype); /* implemented */ +extern NCURSES_EXPORT(int) vidputs (chtype, int (*)(int)); /* implemented */ +extern NCURSES_EXPORT(int) vline (chtype, int); /* generated */ +extern NCURSES_EXPORT(int) vwprintw (WINDOW *, NCURSES_CONST char *,va_list); /* implemented */ +extern NCURSES_EXPORT(int) vw_printw (WINDOW *, NCURSES_CONST char *,va_list); /* generated */ +extern NCURSES_EXPORT(int) vwscanw (WINDOW *, NCURSES_CONST char *,va_list); /* implemented */ +extern NCURSES_EXPORT(int) vw_scanw (WINDOW *, NCURSES_CONST char *,va_list); /* generated */ +extern NCURSES_EXPORT(int) waddch (WINDOW *, const chtype); /* implemented */ +extern NCURSES_EXPORT(int) waddchnstr (WINDOW *,const chtype *const,int); /* implemented */ +extern NCURSES_EXPORT(int) waddchstr (WINDOW *,const chtype *); /* generated */ +extern NCURSES_EXPORT(int) waddnstr (WINDOW *,const char *const,int); /* implemented */ +extern NCURSES_EXPORT(int) waddstr (WINDOW *,const char *); /* generated */ +extern NCURSES_EXPORT(int) wattron (WINDOW *, int); /* generated */ +extern NCURSES_EXPORT(int) wattroff (WINDOW *, int); /* generated */ +extern NCURSES_EXPORT(int) wattrset (WINDOW *, int); /* generated */ +extern NCURSES_EXPORT(int) wattr_get (WINDOW *, attr_t *, short *, void *); /* generated */ +extern NCURSES_EXPORT(int) wattr_on (WINDOW *, NCURSES_CONST attr_t, void *); /* implemented */ +extern NCURSES_EXPORT(int) wattr_off (WINDOW *, NCURSES_CONST attr_t, void *); /* implemented */ +extern NCURSES_EXPORT(int) wattr_set (WINDOW *, attr_t, short, void *); /* generated */ +extern NCURSES_EXPORT(int) wbkgd (WINDOW *,const chtype); /* implemented */ +extern NCURSES_EXPORT(void) wbkgdset (WINDOW *,chtype); /* implemented */ +extern NCURSES_EXPORT(int) wborder (WINDOW *,chtype,chtype,chtype,chtype,chtype,chtype,chtype,chtype); /* implemented */ +extern NCURSES_EXPORT(int) wchgat (WINDOW *, int, attr_t, short, const void *);/* implemented */ +extern NCURSES_EXPORT(int) wclear (WINDOW *); /* implemented */ +extern NCURSES_EXPORT(int) wclrtobot (WINDOW *); /* implemented */ +extern NCURSES_EXPORT(int) wclrtoeol (WINDOW *); /* implemented */ +extern NCURSES_EXPORT(int) wcolor_set (WINDOW*,short,void*); /* implemented */ +extern NCURSES_EXPORT(void) wcursyncup (WINDOW *); /* implemented */ +extern NCURSES_EXPORT(int) wdelch (WINDOW *); /* implemented */ +extern NCURSES_EXPORT(int) wdeleteln (WINDOW *); /* generated */ +extern NCURSES_EXPORT(int) wechochar (WINDOW *, const chtype); /* implemented */ +extern NCURSES_EXPORT(int) werase (WINDOW *); /* implemented */ +extern NCURSES_EXPORT(int) wgetch (WINDOW *); /* implemented */ +extern NCURSES_EXPORT(int) wgetnstr (WINDOW *,char *,int); /* implemented */ +extern NCURSES_EXPORT(int) wgetstr (WINDOW *, char *); /* generated */ +extern NCURSES_EXPORT(int) whline (WINDOW *, chtype, int); /* implemented */ +extern NCURSES_EXPORT(chtype) winch (WINDOW *); /* implemented */ +extern NCURSES_EXPORT(int) winchnstr (WINDOW *, chtype *, int); /* implemented */ +extern NCURSES_EXPORT(int) winchstr (WINDOW *, chtype *); /* generated */ +extern NCURSES_EXPORT(int) winnstr (WINDOW *, char *, int); /* implemented */ +extern NCURSES_EXPORT(int) winsch (WINDOW *, chtype); /* implemented */ +extern NCURSES_EXPORT(int) winsdelln (WINDOW *,int); /* implemented */ +extern NCURSES_EXPORT(int) winsertln (WINDOW *); /* generated */ +extern NCURSES_EXPORT(int) winsnstr (WINDOW *, const char *,int); /* implemented */ +extern NCURSES_EXPORT(int) winsstr (WINDOW *, const char *); /* generated */ +extern NCURSES_EXPORT(int) winstr (WINDOW *, char *); /* generated */ +extern NCURSES_EXPORT(int) wmove (WINDOW *,int,int); /* implemented */ +extern NCURSES_EXPORT(int) wnoutrefresh (WINDOW *); /* implemented */ +extern NCURSES_EXPORT(int) wprintw (WINDOW *, NCURSES_CONST char *,...) /* implemented */ + GCC_PRINTFLIKE(2,3); +extern NCURSES_EXPORT(int) wredrawln (WINDOW *,int,int); /* implemented */ +extern NCURSES_EXPORT(int) wrefresh (WINDOW *); /* implemented */ +extern NCURSES_EXPORT(int) wscanw (WINDOW *, NCURSES_CONST char *,...) /* implemented */ + GCC_SCANFLIKE(2,3); +extern NCURSES_EXPORT(int) wscrl (WINDOW *,int); /* implemented */ +extern NCURSES_EXPORT(int) wsetscrreg (WINDOW *,int,int); /* implemented */ +extern NCURSES_EXPORT(int) wstandout (WINDOW *); /* generated */ +extern NCURSES_EXPORT(int) wstandend (WINDOW *); /* generated */ +extern NCURSES_EXPORT(void) wsyncdown (WINDOW *); /* implemented */ +extern NCURSES_EXPORT(void) wsyncup (WINDOW *); /* implemented */ +extern NCURSES_EXPORT(void) wtimeout (WINDOW *,int); /* implemented */ +extern NCURSES_EXPORT(int) wtouchln (WINDOW *,int,int,int); /* implemented */ +extern NCURSES_EXPORT(int) wvline (WINDOW *,chtype,int); /* implemented */ + +/* + * vid_attr() was implemented originally based on the draft of XSI curses. + */ +#ifndef _XOPEN_SOURCE_EXTENDED +#define vid_attr(a,pair,opts) vidattr(a) +#endif + +/* attributes */ + +#define NCURSES_ATTR_SHIFT 8 +#define NCURSES_BITS(mask,shift) ((mask) << ((shift) + NCURSES_ATTR_SHIFT)) + +#define A_NORMAL 0L +#define A_ATTRIBUTES NCURSES_BITS(~(1UL - 1UL),0) +#define A_CHARTEXT (NCURSES_BITS(1UL,0) - 1UL) +#define A_COLOR NCURSES_BITS(((1UL) << 8) - 1UL,0) +#define A_STANDOUT NCURSES_BITS(1UL,8) +#define A_UNDERLINE NCURSES_BITS(1UL,9) +#define A_REVERSE NCURSES_BITS(1UL,10) +#define A_BLINK NCURSES_BITS(1UL,11) +#define A_DIM NCURSES_BITS(1UL,12) +#define A_BOLD NCURSES_BITS(1UL,13) +#define A_ALTCHARSET NCURSES_BITS(1UL,14) +#define A_INVIS NCURSES_BITS(1UL,15) +#define A_PROTECT NCURSES_BITS(1UL,16) +#define A_HORIZONTAL NCURSES_BITS(1UL,17) +#define A_LEFT NCURSES_BITS(1UL,18) +#define A_LOW NCURSES_BITS(1UL,19) +#define A_RIGHT NCURSES_BITS(1UL,20) +#define A_TOP NCURSES_BITS(1UL,21) +#define A_VERTICAL NCURSES_BITS(1UL,22) + +#define COLOR_PAIR(n) NCURSES_BITS(n, 0) +#define PAIR_NUMBER(a) (((a) & A_COLOR) >> NCURSES_ATTR_SHIFT) + +/* + * pseudo functions + */ +#define wgetstr(w, s) wgetnstr(w, s, -1) +#define getnstr(s, n) wgetnstr(stdscr, s, n) + +#define setterm(term) setupterm(term, 1, (int *)0) + +#define fixterm() reset_prog_mode() +#define resetterm() reset_shell_mode() +#define saveterm() def_prog_mode() +#define crmode() cbreak() +#define nocrmode() nocbreak() +#define gettmode() + +#define getyx(win,y,x) (y = (win)?(win)->_cury:ERR, x = (win)?(win)->_curx:ERR) +#define getbegyx(win,y,x) (y = (win)?(win)->_begy:ERR, x = (win)?(win)->_begx:ERR) +#define getmaxyx(win,y,x) (y = (win)?((win)->_maxy + 1):ERR, x = (win)?((win)->_maxx + 1):ERR) +#define getparyx(win,y,x) (y = (win)?(win)->_pary:ERR, x = (win)?(win)->_parx:ERR) +#define getsyx(y,x) do { if(newscr->_leaveok) (y)=(x)=-1; \ + else getyx(newscr,(y),(x)); \ + } while(0) +#define setsyx(y,x) do { if((y)==-1 && (x)==-1) newscr->_leaveok=TRUE; \ + else {newscr->_leaveok=FALSE;wmove(newscr,(y),(x));} \ + } while(0) + +/* It seems older SYSV curses versions define these */ +#define getattrs(win) ((win)?(win)->_attrs:A_NORMAL) +#define getcurx(win) ((win)?(win)->_curx:ERR) +#define getcury(win) ((win)?(win)->_cury:ERR) +#define getbegx(win) ((win)?(win)->_begx:ERR) +#define getbegy(win) ((win)?(win)->_begy:ERR) +#define getmaxx(win) ((win)?((win)->_maxx + 1):ERR) +#define getmaxy(win) ((win)?((win)->_maxy + 1):ERR) +#define getparx(win) ((win)?(win)->_parx:ERR) +#define getpary(win) ((win)?(win)->_pary:ERR) + +#define wstandout(win) (wattrset(win,A_STANDOUT)) +#define wstandend(win) (wattrset(win,A_NORMAL)) +#define wattr_set(win,a,p,opts) ((win)->_attrs = (((a) & ~A_COLOR) | COLOR_PAIR(p)), OK) + +#define wattron(win,at) wattr_on(win, at, (void *)0) +#define wattroff(win,at) wattr_off(win, at, (void *)0) +#define wattrset(win,at) ((win)->_attrs = (at)) + +#define scroll(win) wscrl(win,1) + +#define touchwin(win) wtouchln((win), 0, getmaxy(win), 1) +#define touchline(win, s, c) wtouchln((win), s, c, 1) +#define untouchwin(win) wtouchln((win), 0, getmaxy(win), 0) + +#define box(win, v, h) wborder(win, v, v, h, h, 0, 0, 0, 0) +#define border(ls, rs, ts, bs, tl, tr, bl, br) wborder(stdscr, ls, rs, ts, bs, tl, tr, bl, br) +#define hline(ch, n) whline(stdscr, ch, n) +#define vline(ch, n) wvline(stdscr, ch, n) + +#define winstr(w, s) winnstr(w, s, -1) +#define winchstr(w, s) winchnstr(w, s, -1) +#define winsstr(w, s) winsnstr(w, s, -1) + +#define redrawwin(win) wredrawln(win, 0, (win)->_maxy+1) +#define waddstr(win,str) waddnstr(win,str,-1) +#define waddchstr(win,str) waddchnstr(win,str,-1) + +/* + * pseudo functions for standard screen + */ + +#define addch(ch) waddch(stdscr,ch) +#define addchnstr(str,n) waddchnstr(stdscr,str,n) +#define addchstr(str) waddchstr(stdscr,str) +#define addnstr(str,n) waddnstr(stdscr,str,n) +#define addstr(str) waddnstr(stdscr,str,-1) +#define attroff(at) wattroff(stdscr,at) +#define attron(at) wattron(stdscr,at) +#define attrset(at) wattrset(stdscr,at) +#define attr_get(ap,cp,o) wattr_get(stdscr,ap,cp,o) +#define attr_off(a,o) wattr_off(stdscr,a,o) +#define attr_on(a,o) wattr_on(stdscr,a,o) +#define attr_set(a,c,o) wattr_set(stdscr,a,c,o) +#define bkgd(ch) wbkgd(stdscr,ch) +#define bkgdset(ch) wbkgdset(stdscr,ch) +#define chgat(n,a,c,o) wchgat(stdscr,n,a,c,o) +#define clear() wclear(stdscr) +#define clrtobot() wclrtobot(stdscr) +#define clrtoeol() wclrtoeol(stdscr) +#define color_set(c,o) wcolor_set(stdscr,c,o) +#define delch() wdelch(stdscr) +#define deleteln() winsdelln(stdscr,-1) +#define echochar(c) wechochar(stdscr,c) +#define erase() werase(stdscr) +#define getch() wgetch(stdscr) +#define getstr(str) wgetstr(stdscr,str) +#define inch() winch(stdscr) +#define inchnstr(s,n) winchnstr(stdscr,s,n) +#define inchstr(s) winchstr(stdscr,s) +#define innstr(s,n) winnstr(stdscr,s,n) +#define insch(c) winsch(stdscr,c) +#define insdelln(n) winsdelln(stdscr,n) +#define insertln() winsdelln(stdscr,1) +#define insnstr(s,n) winsnstr(stdscr,s,n) +#define insstr(s) winsstr(stdscr,s) +#define instr(s) winstr(stdscr,s) +#define move(y,x) wmove(stdscr,y,x) +#define refresh() wrefresh(stdscr) +#define scrl(n) wscrl(stdscr,n) +#define setscrreg(t,b) wsetscrreg(stdscr,t,b) +#define standend() wstandend(stdscr) +#define standout() wstandout(stdscr) +#define timeout(delay) wtimeout(stdscr,delay) +#define wdeleteln(win) winsdelln(win,-1) +#define winsertln(win) winsdelln(win,1) + +/* + * mv functions + */ + +#define mvwaddch(win,y,x,ch) (wmove(win,y,x) == ERR ? ERR : waddch(win,ch)) +#define mvwaddchnstr(win,y,x,str,n) (wmove(win,y,x) == ERR ? ERR : waddchnstr(win,str,n)) +#define mvwaddchstr(win,y,x,str) (wmove(win,y,x) == ERR ? ERR : waddchnstr(win,str,-1)) +#define mvwaddnstr(win,y,x,str,n) (wmove(win,y,x) == ERR ? ERR : waddnstr(win,str,n)) +#define mvwaddstr(win,y,x,str) (wmove(win,y,x) == ERR ? ERR : waddnstr(win,str,-1)) +#define mvwdelch(win,y,x) (wmove(win,y,x) == ERR ? ERR : wdelch(win)) +#define mvwchgat(win,y,x,n,a,c,o) (wmove(win,y,x) == ERR ? ERR : wchgat(win,n,a,c,o)) +#define mvwgetch(win,y,x) (wmove(win,y,x) == ERR ? ERR : wgetch(win)) +#define mvwgetnstr(win,y,x,str,n) (wmove(win,y,x) == ERR ? ERR : wgetnstr(win,str,n)) +#define mvwgetstr(win,y,x,str) (wmove(win,y,x) == ERR ? ERR : wgetstr(win,str)) +#define mvwhline(win,y,x,c,n) (wmove(win,y,x) == ERR ? ERR : whline(win,c,n)) +#define mvwinch(win,y,x) (wmove(win,y,x) == ERR ? (chtype)ERR : winch(win)) +#define mvwinchnstr(win,y,x,s,n) (wmove(win,y,x) == ERR ? ERR : winchnstr(win,s,n)) +#define mvwinchstr(win,y,x,s) (wmove(win,y,x) == ERR ? ERR : winchstr(win,s)) +#define mvwinnstr(win,y,x,s,n) (wmove(win,y,x) == ERR ? ERR : winnstr(win,s,n)) +#define mvwinsch(win,y,x,c) (wmove(win,y,x) == ERR ? ERR : winsch(win,c)) +#define mvwinsnstr(win,y,x,s,n) (wmove(win,y,x) == ERR ? ERR : winsnstr(win,s,n)) +#define mvwinsstr(win,y,x,s) (wmove(win,y,x) == ERR ? ERR : winsstr(win,s)) +#define mvwinstr(win,y,x,s) (wmove(win,y,x) == ERR ? ERR : winstr(win,s)) +#define mvwvline(win,y,x,c,n) (wmove(win,y,x) == ERR ? ERR : wvline(win,c,n)) + +#define mvaddch(y,x,ch) mvwaddch(stdscr,y,x,ch) +#define mvaddchnstr(y,x,str,n) mvwaddchnstr(stdscr,y,x,str,n) +#define mvaddchstr(y,x,str) mvwaddchstr(stdscr,y,x,str) +#define mvaddnstr(y,x,str,n) mvwaddnstr(stdscr,y,x,str,n) +#define mvaddstr(y,x,str) mvwaddstr(stdscr,y,x,str) +#define mvchgat(y,x,n,a,c,o) mvwchgat(stdscr,y,x,n,a,c,o) +#define mvdelch(y,x) mvwdelch(stdscr,y,x) +#define mvgetch(y,x) mvwgetch(stdscr,y,x) +#define mvgetnstr(y,x,str,n) mvwgetnstr(stdscr,y,x,str,n) +#define mvgetstr(y,x,str) mvwgetstr(stdscr,y,x,str) +#define mvhline(y,x,c,n) mvwhline(stdscr,y,x,c,n) +#define mvinch(y,x) mvwinch(stdscr,y,x) +#define mvinchnstr(y,x,s,n) mvwinchnstr(stdscr,y,x,s,n) +#define mvinchstr(y,x,s) mvwinchstr(stdscr,y,x,s) +#define mvinnstr(y,x,s,n) mvwinnstr(stdscr,y,x,s,n) +#define mvinsch(y,x,c) mvwinsch(stdscr,y,x,c) +#define mvinsnstr(y,x,s,n) mvwinsnstr(stdscr,y,x,s,n) +#define mvinsstr(y,x,s) mvwinsstr(stdscr,y,x,s) +#define mvinstr(y,x,s) mvwinstr(stdscr,y,x,s) +#define mvvline(y,x,c,n) mvwvline(stdscr,y,x,c,n) + +/* + * Some wide-character functions do not depend on the extensions. + */ +#define getbkgd(win) ((win)->_bkgd) + +#define slk_attr_off(a,v) ((v) ? ERR : slk_attroff(a)) +#define slk_attr_on(a,v) ((v) ? ERR : slk_attron(a)) + +#define wattr_get(win,a,p,opts) ((void)((a) != 0 && (*(a) = (win)->_attrs)), \ + (void)((p) != 0 && (*(p) = PAIR_NUMBER((win)->_attrs))), \ + OK) + +/* + * XSI curses deprecates SVr4 vwprintw/vwscanw, which are supposed to use + * varargs.h. It adds new calls vw_printw/vw_scanw, which are supposed to + * use POSIX stdarg.h. The ncurses versions of vwprintw/vwscanw already + * use stdarg.h, so... + */ +#define vw_printw vwprintw +#define vw_scanw vwscanw + +/* + * Export fallback function for use in C++ binding. + */ +#if !1 +#define vsscanf(a,b,c) _nc_vsscanf(a,b,c) +NCURSES_EXPORT(int) vsscanf(const char *, const char *, va_list); +#endif + +/* + * Pseudo-character tokens outside ASCII range. The curses wgetch() function + * will return any given one of these only if the corresponding k- capability + * is defined in your terminal's terminfo entry. + * + * Some keys (KEY_A1, etc) are arranged like this: + * a1 up a3 + * left b2 right + * c1 down c3 + * + * A few key codes do not depend upon the terminfo entry. + */ +#define KEY_CODE_YES 0400 /* A wchar_t contains a key code */ +#define KEY_MIN 0401 /* Minimum curses key */ +#define KEY_BREAK 0401 /* Break key (unreliable) */ +#define KEY_SRESET 0530 /* Soft (partial) reset (unreliable) */ +#define KEY_RESET 0531 /* Reset or hard reset (unreliable) */ +/* + * These definitions were generated by /usr/src/lib/libncurses/../../contrib/ncurses/include/MKkey_defs.sh /usr/src/lib/libncurses/../../contrib/ncurses/include/Caps + */ +#define KEY_DOWN 0402 /* down-arrow key */ +#define KEY_UP 0403 /* up-arrow key */ +#define KEY_LEFT 0404 /* left-arrow key */ +#define KEY_RIGHT 0405 /* right-arrow key */ +#define KEY_HOME 0406 /* home key */ +#define KEY_BACKSPACE 0407 /* backspace key */ +#define KEY_F0 0410 /* Function keys. Space for 64 */ +#define KEY_F(n) (KEY_F0+(n)) /* Value of function key n */ +#define KEY_DL 0510 /* delete-line key */ +#define KEY_IL 0511 /* insert-line key */ +#define KEY_DC 0512 /* delete-character key */ +#define KEY_IC 0513 /* insert-character key */ +#define KEY_EIC 0514 /* sent by rmir or smir in insert mode */ +#define KEY_CLEAR 0515 /* clear-screen or erase key */ +#define KEY_EOS 0516 /* clear-to-end-of-screen key */ +#define KEY_EOL 0517 /* clear-to-end-of-line key */ +#define KEY_SF 0520 /* scroll-forward key */ +#define KEY_SR 0521 /* scroll-backward key */ +#define KEY_NPAGE 0522 /* next-page key */ +#define KEY_PPAGE 0523 /* previous-page key */ +#define KEY_STAB 0524 /* set-tab key */ +#define KEY_CTAB 0525 /* clear-tab key */ +#define KEY_CATAB 0526 /* clear-all-tabs key */ +#define KEY_ENTER 0527 /* enter/send key */ +#define KEY_PRINT 0532 /* print key */ +#define KEY_LL 0533 /* lower-left key (home down) */ +#define KEY_A1 0534 /* upper left of keypad */ +#define KEY_A3 0535 /* upper right of keypad */ +#define KEY_B2 0536 /* center of keypad */ +#define KEY_C1 0537 /* lower left of keypad */ +#define KEY_C3 0540 /* lower right of keypad */ +#define KEY_BTAB 0541 /* back-tab key */ +#define KEY_BEG 0542 /* begin key */ +#define KEY_CANCEL 0543 /* cancel key */ +#define KEY_CLOSE 0544 /* close key */ +#define KEY_COMMAND 0545 /* command key */ +#define KEY_COPY 0546 /* copy key */ +#define KEY_CREATE 0547 /* create key */ +#define KEY_END 0550 /* end key */ +#define KEY_EXIT 0551 /* exit key */ +#define KEY_FIND 0552 /* find key */ +#define KEY_HELP 0553 /* help key */ +#define KEY_MARK 0554 /* mark key */ +#define KEY_MESSAGE 0555 /* message key */ +#define KEY_MOVE 0556 /* move key */ +#define KEY_NEXT 0557 /* next key */ +#define KEY_OPEN 0560 /* open key */ +#define KEY_OPTIONS 0561 /* options key */ +#define KEY_PREVIOUS 0562 /* previous key */ +#define KEY_REDO 0563 /* redo key */ +#define KEY_REFERENCE 0564 /* reference key */ +#define KEY_REFRESH 0565 /* refresh key */ +#define KEY_REPLACE 0566 /* replace key */ +#define KEY_RESTART 0567 /* restart key */ +#define KEY_RESUME 0570 /* resume key */ +#define KEY_SAVE 0571 /* save key */ +#define KEY_SBEG 0572 /* shifted begin key */ +#define KEY_SCANCEL 0573 /* shifted cancel key */ +#define KEY_SCOMMAND 0574 /* shifted command key */ +#define KEY_SCOPY 0575 /* shifted copy key */ +#define KEY_SCREATE 0576 /* shifted create key */ +#define KEY_SDC 0577 /* shifted delete-character key */ +#define KEY_SDL 0600 /* shifted delete-line key */ +#define KEY_SELECT 0601 /* select key */ +#define KEY_SEND 0602 /* shifted end key */ +#define KEY_SEOL 0603 /* shifted clear-to-end-of-line key */ +#define KEY_SEXIT 0604 /* shifted exit key */ +#define KEY_SFIND 0605 /* shifted find key */ +#define KEY_SHELP 0606 /* shifted help key */ +#define KEY_SHOME 0607 /* shifted home key */ +#define KEY_SIC 0610 /* shifted insert-character key */ +#define KEY_SLEFT 0611 /* shifted left-arrow key */ +#define KEY_SMESSAGE 0612 /* shifted message key */ +#define KEY_SMOVE 0613 /* shifted move key */ +#define KEY_SNEXT 0614 /* shifted next key */ +#define KEY_SOPTIONS 0615 /* shifted options key */ +#define KEY_SPREVIOUS 0616 /* shifted previous key */ +#define KEY_SPRINT 0617 /* shifted print key */ +#define KEY_SREDO 0620 /* shifted redo key */ +#define KEY_SREPLACE 0621 /* shifted replace key */ +#define KEY_SRIGHT 0622 /* shifted right-arrow key */ +#define KEY_SRSUME 0623 /* shifted resume key */ +#define KEY_SSAVE 0624 /* shifted save key */ +#define KEY_SSUSPEND 0625 /* shifted suspend key */ +#define KEY_SUNDO 0626 /* shifted undo key */ +#define KEY_SUSPEND 0627 /* suspend key */ +#define KEY_UNDO 0630 /* undo key */ +#define KEY_MOUSE 0631 /* Mouse event has occurred */ +#define KEY_RESIZE 0632 /* Terminal resize event */ + +#define KEY_MAX 0777 /* Maximum key value is 0632 */ +/* $Id$ */ + +/* mouse interface */ +#define NCURSES_MOUSE_VERSION 1 + +/* event masks */ +#define BUTTON1_RELEASED 000000000001L +#define BUTTON1_PRESSED 000000000002L +#define BUTTON1_CLICKED 000000000004L +#define BUTTON1_DOUBLE_CLICKED 000000000010L +#define BUTTON1_TRIPLE_CLICKED 000000000020L +#define BUTTON1_RESERVED_EVENT 000000000040L +#define BUTTON2_RELEASED 000000000100L +#define BUTTON2_PRESSED 000000000200L +#define BUTTON2_CLICKED 000000000400L +#define BUTTON2_DOUBLE_CLICKED 000000001000L +#define BUTTON2_TRIPLE_CLICKED 000000002000L +#define BUTTON2_RESERVED_EVENT 000000004000L +#define BUTTON3_RELEASED 000000010000L +#define BUTTON3_PRESSED 000000020000L +#define BUTTON3_CLICKED 000000040000L +#define BUTTON3_DOUBLE_CLICKED 000000100000L +#define BUTTON3_TRIPLE_CLICKED 000000200000L +#define BUTTON3_RESERVED_EVENT 000000400000L +#define BUTTON4_RELEASED 000001000000L +#define BUTTON4_PRESSED 000002000000L +#define BUTTON4_CLICKED 000004000000L +#define BUTTON4_DOUBLE_CLICKED 000010000000L +#define BUTTON4_TRIPLE_CLICKED 000020000000L +#define BUTTON4_RESERVED_EVENT 000040000000L +#define BUTTON_CTRL 000100000000L +#define BUTTON_SHIFT 000200000000L +#define BUTTON_ALT 000400000000L +#define ALL_MOUSE_EVENTS 000777777777L +#define REPORT_MOUSE_POSITION 001000000000L + +/* macros to extract single event-bits from masks */ +#define BUTTON_RELEASE(e, x) ((e) & (001 << (6 * ((x) - 1)))) +#define BUTTON_PRESS(e, x) ((e) & (002 << (6 * ((x) - 1)))) +#define BUTTON_CLICK(e, x) ((e) & (004 << (6 * ((x) - 1)))) +#define BUTTON_DOUBLE_CLICK(e, x) ((e) & (010 << (6 * ((x) - 1)))) +#define BUTTON_TRIPLE_CLICK(e, x) ((e) & (020 << (6 * ((x) - 1)))) +#define BUTTON_RESERVED_EVENT(e, x) ((e) & (040 << (6 * ((x) - 1)))) + +typedef unsigned long mmask_t; + +typedef struct +{ + short id; /* ID to distinguish multiple devices */ + int x, y, z; /* event coordinates (character-cell) */ + mmask_t bstate; /* button state bits */ +} +MEVENT; + +extern NCURSES_EXPORT(int) getmouse (MEVENT *); +extern NCURSES_EXPORT(int) ungetmouse (MEVENT *); +extern NCURSES_EXPORT(mmask_t) mousemask (mmask_t, mmask_t *); +extern NCURSES_EXPORT(bool) wenclose (const WINDOW *, int, int); +extern NCURSES_EXPORT(int) mouseinterval (int); +extern NCURSES_EXPORT(bool) wmouse_trafo (const WINDOW* win,int* y, int* x, bool to_screen); +extern NCURSES_EXPORT(bool) mouse_trafo (int*, int*, bool); /* generated */ + +#define mouse_trafo(y,x,to_screen) wmouse_trafo(stdscr,y,x,to_screen) + +/* other non-XSI functions */ + +extern NCURSES_EXPORT(int) mcprint (char *, int); /* direct data to printer */ +extern NCURSES_EXPORT(int) has_key (int); /* do we have given key? */ + +/* Debugging : use with libncurses_g.a */ + +extern NCURSES_EXPORT(void) _tracef (const char *, ...) GCC_PRINTFLIKE(1,2); +extern NCURSES_EXPORT(void) _tracedump (const char *, WINDOW *); +extern NCURSES_EXPORT(char *) _traceattr (attr_t); +extern NCURSES_EXPORT(char *) _traceattr2 (int, chtype); +extern NCURSES_EXPORT(char *) _nc_tracebits (void); +extern NCURSES_EXPORT(char *) _tracechar (int); +extern NCURSES_EXPORT(char *) _tracechtype (chtype); +extern NCURSES_EXPORT(char *) _tracechtype2 (int, chtype); +#ifdef _XOPEN_SOURCE_EXTENDED +#define _tracech_t _tracecchar_t +extern NCURSES_EXPORT(char *) _tracecchar_t (const cchar_t *); +#define _tracech_t2 _tracecchar_t2 +extern NCURSES_EXPORT(char *) _tracecchar_t2 (int, const cchar_t *); +#else +#define _tracech_t _tracechtype +#define _tracech_t2 _tracechtype2 +#endif +extern NCURSES_EXPORT(char *) _tracemouse (const MEVENT *); +extern NCURSES_EXPORT(void) trace (const unsigned int); + +/* trace masks */ +#define TRACE_DISABLE 0x0000 /* turn off tracing */ +#define TRACE_TIMES 0x0001 /* trace user and system times of updates */ +#define TRACE_TPUTS 0x0002 /* trace tputs calls */ +#define TRACE_UPDATE 0x0004 /* trace update actions, old & new screens */ +#define TRACE_MOVE 0x0008 /* trace cursor moves and scrolls */ +#define TRACE_CHARPUT 0x0010 /* trace all character outputs */ +#define TRACE_ORDINARY 0x001F /* trace all update actions */ +#define TRACE_CALLS 0x0020 /* trace all curses calls */ +#define TRACE_VIRTPUT 0x0040 /* trace virtual character puts */ +#define TRACE_IEVENT 0x0080 /* trace low-level input processing */ +#define TRACE_BITS 0x0100 /* trace state of TTY control bits */ +#define TRACE_ICALLS 0x0200 /* trace internal/nested calls */ +#define TRACE_CCALLS 0x0400 /* trace per-character calls */ +#define TRACE_DATABASE 0x0800 /* trace read/write of terminfo/termcap data */ +#define TRACE_ATTRS 0x1000 /* trace attribute updates */ +#define TRACE_MAXIMUM 0xffff /* maximum trace level */ + +#if defined(TRACE) || defined(NCURSES_TEST) +extern NCURSES_EXPORT_VAR(int) _nc_optimize_enable; /* enable optimizations */ +#ifdef _XOPEN_SOURCE_EXTENDED +extern NCURSES_EXPORT(const char *) _nc_viswbuf(const wchar_t *); +#endif +extern NCURSES_EXPORT(const char *) _nc_visbuf (const char *); +#define OPTIMIZE_MVCUR 0x01 /* cursor movement optimization */ +#define OPTIMIZE_HASHMAP 0x02 /* diff hashing to detect scrolls */ +#define OPTIMIZE_SCROLL 0x04 /* scroll optimization */ +#define OPTIMIZE_ALL 0xff /* enable all optimizations (dflt) */ +#endif + +#ifdef __cplusplus + +/* these names conflict with STL */ +#undef box +#undef clear +#undef erase +#undef move +#undef refresh + +} +#endif + +#endif /* __NCURSES_H */ diff --git a/src/include.new/ncurses_dll.h b/src/include.new/ncurses_dll.h new file mode 100644 index 0000000..28a5253 --- /dev/null +++ b/src/include.new/ncurses_dll.h @@ -0,0 +1,48 @@ +/* $Id$ */ + +#ifndef NCURSES_DLL_H_incl +#define NCURSES_DLL_H_incl 1 + +#undef NCURSES_DLL /* cygwin dll not implemented */ +#define NCURSES_STATIC /* cygwin dll not implemented */ + +#if defined(__CYGWIN__) +# if defined(NCURSES_DLL) +# if defined(NCURSES_STATIC) +# undef NCURSES_STATIC +# endif +# endif +# undef NCURSES_IMPEXP +# undef NCURSES_API +# undef NCURSES_EXPORT(type) +# undef NCURSES_EXPORT_VAR(type) +# if defined(NCURSES_DLL) +/* building a DLL */ +# define NCURSES_IMPEXP __declspec(dllexport) +# elif defined(NCURSES_STATIC) +/* building or linking to a static library */ +# define NCURSES_IMPEXP /* nothing */ +# else +/* linking to the DLL */ +# define NCURSES_IMPEXP __declspec(dllimport) +# endif +# define NCURSES_API __cdecl +# define NCURSES_EXPORT(type) NCURSES_IMPEXP type NCURSES_API +# define NCURSES_EXPORT_VAR(type) NCURSES_IMPEXP type +#endif + +/* Take care of non-cygwin platforms */ +#if !defined(NCURSES_IMPEXP) +# define NCURSES_IMPEXP /* nothing */ +#endif +#if !defined(NCURSES_API) +# define NCURSES_API /* nothing */ +#endif +#if !defined(NCURSES_EXPORT) +# define NCURSES_EXPORT(type) NCURSES_IMPEXP type NCURSES_API +#endif +#if !defined(NCURSES_EXPORT_VAR) +# define NCURSES_EXPORT_VAR(type) NCURSES_IMPEXP type +#endif + +#endif /* NCURSES_DLL_H_incl */ diff --git a/src/include.new/ndbm.h b/src/include.new/ndbm.h new file mode 100644 index 0000000..1637cd9 --- /dev/null +++ b/src/include.new/ndbm.h @@ -0,0 +1,80 @@ +/*- + * Copyright (c) 1990, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Margo Seltzer. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)ndbm.h 8.1 (Berkeley) 6/2/93 + * $FreeBSD: src/include/ndbm.h,v 1.4 2002/03/23 17:24:53 imp Exp $ + */ + +#ifndef _NDBM_H_ +#define _NDBM_H_ + +#include + +/* Map dbm interface onto db(3). */ +#define DBM_RDONLY O_RDONLY + +/* Flags to dbm_store(). */ +#define DBM_INSERT 0 +#define DBM_REPLACE 1 + +/* + * The db(3) support for ndbm always appends this suffix to the + * file name to avoid overwriting the user's original database. + */ +#define DBM_SUFFIX ".db" + +typedef struct { + char *dptr; + int dsize; +} datum; + +typedef DB DBM; +#define dbm_pagfno(a) DBM_PAGFNO_NOT_AVAILABLE + +__BEGIN_DECLS +int dbm_clearerr(DBM *); +void dbm_close(DBM *); +int dbm_delete(DBM *, datum); +int dbm_error(DBM *); +datum dbm_fetch(DBM *, datum); +datum dbm_firstkey(DBM *); +long dbm_forder(DBM *, datum); +datum dbm_nextkey(DBM *); +DBM *dbm_open(const char *, int, int); +int dbm_store(DBM *, datum, datum, int); +int dbm_dirfno(DBM *); +__END_DECLS + +#endif /* !_NDBM_H_ */ diff --git a/src/include.new/netconfig.h b/src/include.new/netconfig.h new file mode 100644 index 0000000..cead321 --- /dev/null +++ b/src/include.new/netconfig.h @@ -0,0 +1,96 @@ +/* $NetBSD: netconfig.h,v 1.1 2000/06/02 22:57:54 fvdl Exp $ */ +/* $FreeBSD: src/include/netconfig.h,v 1.3 2002/03/23 17:24:53 imp Exp $ */ + + +#ifndef _NETCONFIG_H_ +#define _NETCONFIG_H_ + +#include + +#define NETCONFIG "/etc/netconfig" +#define NETPATH "NETPATH" + +struct netconfig { + char *nc_netid; /* Network ID */ + unsigned long nc_semantics; /* Semantics (see below) */ + unsigned long nc_flag; /* Flags (see below) */ + char *nc_protofmly; /* Protocol family */ + char *nc_proto; /* Protocol name */ + char *nc_device; /* Network device pathname */ + unsigned long nc_nlookups; /* Number of directory lookup libs */ + char **nc_lookups; /* Names of the libraries */ + unsigned long nc_unused[9]; /* reserved */ +}; + +typedef struct { + struct netconfig **nc_head; + struct netconfig **nc_curr; +} NCONF_HANDLE; + +/* + * nc_semantics values + */ +#define NC_TPI_CLTS 1 +#define NC_TPI_COTS 2 +#define NC_TPI_COTS_ORD 3 +#define NC_TPI_RAW 4 + +/* + * nc_flag values + */ +#define NC_NOFLAG 0x00 +#define NC_VISIBLE 0x01 +#define NC_BROADCAST 0x02 + +/* + * nc_protofmly values + */ +#define NC_NOPROTOFMLY "-" +#define NC_LOOPBACK "loopback" +#define NC_INET "inet" +#define NC_INET6 "inet6" +#define NC_IMPLINK "implink" +#define NC_PUP "pup" +#define NC_CHAOS "chaos" +#define NC_NS "ns" +#define NC_NBS "nbs" +#define NC_ECMA "ecma" +#define NC_DATAKIT "datakit" +#define NC_CCITT "ccitt" +#define NC_SNA "sna" +#define NC_DECNET "decnet" +#define NC_DLI "dli" +#define NC_LAT "lat" +#define NC_HYLINK "hylink" +#define NC_APPLETALK "appletalk" +#define NC_NIT "nit" +#define NC_IEEE802 "ieee802" +#define NC_OSI "osi" +#define NC_X25 "x25" +#define NC_OSINET "osinet" +#define NC_GOSIP "gosip" + +/* + * nc_proto values + */ +#define NC_NOPROTO "-" +#define NC_TCP "tcp" +#define NC_UDP "udp" +#define NC_ICMP "icmp" + +__BEGIN_DECLS +void *setnetconfig(void); +struct netconfig *getnetconfig(void *); +struct netconfig *getnetconfigent(const char *); +void freenetconfigent(struct netconfig *); +int endnetconfig(void *); + +void *setnetpath(void); +struct netconfig *getnetpath(void *); +int endnetpath(void *); + +void nc_perror(const char *); +char *nc_sperror(void); +__END_DECLS + +#endif /* _NETCONFIG_H_ */ diff --git a/src/include.new/netdb.h b/src/include.new/netdb.h new file mode 100644 index 0000000..3b00adc --- /dev/null +++ b/src/include.new/netdb.h @@ -0,0 +1,289 @@ +/*- + * Copyright (c) 1980, 1983, 1988, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * - + * Portions Copyright (c) 1993 by Digital Equipment Corporation. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies, and that + * the name of Digital Equipment Corporation not be used in advertising or + * publicity pertaining to distribution of the document or software without + * specific, written prior permission. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL + * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT + * CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + * - + * --Copyright-- + */ + +/* + * @(#)netdb.h 8.1 (Berkeley) 6/2/93 + * From: Id: netdb.h,v 8.9 1996/11/19 08:39:29 vixie Exp $ + * $FreeBSD: src/include/netdb.h,v 1.38.2.2 2006/07/17 10:09:54 ume Exp $ + */ + +#ifndef _NETDB_H_ +#define _NETDB_H_ + +#include +#include + +#ifndef _SIZE_T_DECLARED +typedef __size_t size_t; +#define _SIZE_T_DECLARED +#endif + +#ifndef _SOCKLEN_T_DECLARED +typedef __socklen_t socklen_t; +#define _SOCKLEN_T_DECLARED +#endif + +#ifndef _UINT32_T_DECLARED +typedef __uint32_t uint32_t; +#define _UINT32_T_DECLARED +#endif + +#ifndef _PATH_HEQUIV +# define _PATH_HEQUIV "/etc/hosts.equiv" +#endif +#define _PATH_HOSTS "/etc/hosts" +#define _PATH_NETWORKS "/etc/networks" +#define _PATH_PROTOCOLS "/etc/protocols" +#define _PATH_SERVICES "/etc/services" + +#define h_errno (*__h_errno()) + +/* + * Structures returned by network data base library. All addresses are + * supplied in host order, and returned in network order (suitable for + * use in system calls). + */ +struct hostent { + char *h_name; /* official name of host */ + char **h_aliases; /* alias list */ + int h_addrtype; /* host address type */ + int h_length; /* length of address */ + char **h_addr_list; /* list of addresses from name server */ +#define h_addr h_addr_list[0] /* address, for backward compatibility */ +}; + +struct netent { + char *n_name; /* official name of net */ + char **n_aliases; /* alias list */ + int n_addrtype; /* net address type */ + uint32_t n_net; /* network # */ +}; + +struct servent { + char *s_name; /* official service name */ + char **s_aliases; /* alias list */ + int s_port; /* port # */ + char *s_proto; /* protocol to use */ +}; + +struct protoent { + char *p_name; /* official protocol name */ + char **p_aliases; /* alias list */ + int p_proto; /* protocol # */ +}; + +struct addrinfo { + int ai_flags; /* AI_PASSIVE, AI_CANONNAME, AI_NUMERICHOST */ + int ai_family; /* PF_xxx */ + int ai_socktype; /* SOCK_xxx */ + int ai_protocol; /* 0 or IPPROTO_xxx for IPv4 and IPv6 */ + socklen_t ai_addrlen; /* length of ai_addr */ + char *ai_canonname; /* canonical name for hostname */ + struct sockaddr *ai_addr; /* binary address */ + struct addrinfo *ai_next; /* next structure in linked list */ +}; + +/* + * Error return codes from gethostbyname() and gethostbyaddr() + * (left in h_errno). + */ + +#define NETDB_INTERNAL -1 /* see errno */ +#define NETDB_SUCCESS 0 /* no problem */ +#define HOST_NOT_FOUND 1 /* Authoritative Answer Host not found */ +#define TRY_AGAIN 2 /* Non-Authoritative Host not found, or SERVERFAIL */ +#define NO_RECOVERY 3 /* Non recoverable errors, FORMERR, REFUSED, NOTIMP */ +#define NO_DATA 4 /* Valid name, no data record of requested type */ +#define NO_ADDRESS NO_DATA /* no address, look for MX record */ + +/* + * Error return codes from getaddrinfo() + */ +#if 0 +/* obsoleted */ +#define EAI_ADDRFAMILY 1 /* address family for hostname not supported */ +#endif +#define EAI_AGAIN 2 /* temporary failure in name resolution */ +#define EAI_BADFLAGS 3 /* invalid value for ai_flags */ +#define EAI_FAIL 4 /* non-recoverable failure in name resolution */ +#define EAI_FAMILY 5 /* ai_family not supported */ +#define EAI_MEMORY 6 /* memory allocation failure */ +#if 0 +/* obsoleted */ +#define EAI_NODATA 7 /* no address associated with hostname */ +#endif +#define EAI_NONAME 8 /* hostname nor servname provided, or not known */ +#define EAI_SERVICE 9 /* servname not supported for ai_socktype */ +#define EAI_SOCKTYPE 10 /* ai_socktype not supported */ +#define EAI_SYSTEM 11 /* system error returned in errno */ +#define EAI_BADHINTS 12 +#define EAI_PROTOCOL 13 +#define EAI_MAX 14 + +/* + * Flag values for getaddrinfo() + */ +#define AI_PASSIVE 0x00000001 /* get address to use bind() */ +#define AI_CANONNAME 0x00000002 /* fill ai_canonname */ +#define AI_NUMERICHOST 0x00000004 /* prevent host name resolution */ +#define AI_NUMERICSERV 0x00000008 /* prevent service name resolution */ +/* valid flags for addrinfo (not a standard def, apps should not use it) */ +#define AI_MASK \ + (AI_PASSIVE | AI_CANONNAME | AI_NUMERICHOST | AI_NUMERICSERV | \ + AI_ADDRCONFIG) + +#define AI_ALL 0x00000100 /* IPv6 and IPv4-mapped (with AI_V4MAPPED) */ +#define AI_V4MAPPED_CFG 0x00000200 /* accept IPv4-mapped if kernel supports */ +#define AI_ADDRCONFIG 0x00000400 /* only if any address is assigned */ +#define AI_V4MAPPED 0x00000800 /* accept IPv4-mapped IPv6 address */ +/* special recommended flags for getipnodebyname */ +#define AI_DEFAULT (AI_V4MAPPED_CFG | AI_ADDRCONFIG) + +/* + * Constants for getnameinfo() + */ +#define NI_MAXHOST 1025 +#define NI_MAXSERV 32 + +/* + * Flag values for getnameinfo() + */ +#define NI_NOFQDN 0x00000001 +#define NI_NUMERICHOST 0x00000002 +#define NI_NAMEREQD 0x00000004 +#define NI_NUMERICSERV 0x00000008 +#define NI_DGRAM 0x00000010 +#if 0 /* obsolete */ +#define NI_WITHSCOPEID 0x00000020 +#endif + +/* + * Scope delimit character + */ +#define SCOPE_DELIMITER '%' + +__BEGIN_DECLS +void endhostent(void); +void endnetent(void); +void endnetgrent(void); +void endprotoent(void); +void endservent(void); +void freehostent(struct hostent *); +struct hostent *gethostbyaddr(const void *, int, int); +int gethostbyaddr_r(const void *, socklen_t, int, struct hostent *, + char *, size_t, struct hostent **, int *); +struct hostent *gethostbyname(const char *); +int gethostbyname_r(const char *, struct hostent *, char *, size_t, + struct hostent **, int *); +struct hostent *gethostbyname2(const char *, int); +int gethostbyname2_r(const char *, int, struct hostent *, char *, + size_t, struct hostent **, int *); +struct hostent *gethostent(void); +int gethostent_r(struct hostent *, char *, size_t, + struct hostent **, int *); +struct hostent *getipnodebyaddr(const void *, size_t, int, int *); +struct hostent *getipnodebyname(const char *, int, int, int *); +struct netent *getnetbyaddr(uint32_t, int); +int getnetbyaddr_r(uint32_t, int, struct netent *, char *, size_t, + struct netent**, int *); +struct netent *getnetbyname(const char *); +int getnetbyname_r(const char *, struct netent *, char *, size_t, + struct netent **, int *); +struct netent *getnetent(void); +int getnetent_r(struct netent *, char *, size_t, struct netent **, + int *); +int getnetgrent(char **, char **, char **); +struct protoent *getprotobyname(const char *); +int getprotobyname_r(const char *, struct protoent *, char *, + size_t, struct protoent **); +struct protoent *getprotobynumber(int); +int getprotobynumber_r(int, struct protoent *, char *, size_t, + struct protoent **); +struct protoent *getprotoent(void); +int getprotoent_r(struct protoent *, char *, size_t, + struct protoent **); +struct servent *getservbyname(const char *, const char *); +int getservbyname_r(const char *, const char *, struct servent *, + char *, size_t, struct servent **); +struct servent *getservbyport(int, const char *); +int getservbyport_r(int, const char *, struct servent *, char *, + size_t, struct servent **); +struct servent *getservent(void); +int getservent_r(struct servent *, char *, size_t, + struct servent **); +void herror(const char *); +__const char *hstrerror(int); +int innetgr(const char *, const char *, const char *, const char *); +void sethostent(int); +/* void sethostfile(const char *); */ +void setnetent(int); +void setprotoent(int); +int getaddrinfo(const char *, const char *, + const struct addrinfo *, struct addrinfo **); +int getnameinfo(const struct sockaddr *, socklen_t, char *, + size_t, char *, size_t, int); +void freeaddrinfo(struct addrinfo *); +const char *gai_strerror(int); +void setnetgrent(const char *); +void setservent(int); + +/* + * PRIVATE functions specific to the FreeBSD implementation + */ + +/* DO NOT USE THESE, THEY ARE SUBJECT TO CHANGE AND ARE NOT PORTABLE!!! */ +int * __h_errno(void); +__END_DECLS + +#endif /* !_NETDB_H_ */ diff --git a/src/include.new/netgraph.h b/src/include.new/netgraph.h new file mode 100644 index 0000000..21038a4 --- /dev/null +++ b/src/include.new/netgraph.h @@ -0,0 +1,69 @@ + +/* + * netgraph.h + * + * Copyright (c) 1996-1999 Whistle Communications, Inc. + * All rights reserved. + * + * Subject to the following obligations and disclaimer of warranty, use and + * redistribution of this software, in source or object code forms, with or + * without modifications are expressly permitted by Whistle Communications; + * provided, however, that: + * 1. Any and all reproductions of the source or object code must include the + * copyright notice above and the following disclaimer of warranties; and + * 2. No rights are granted, in any manner or form, to use Whistle + * Communications, Inc. trademarks, including the mark "WHISTLE + * COMMUNICATIONS" on advertising, endorsements, or otherwise except as + * such appears in the above copyright notice or in the software. + * + * THIS SOFTWARE IS BEING PROVIDED BY WHISTLE COMMUNICATIONS "AS IS", AND + * TO THE MAXIMUM EXTENT PERMITTED BY LAW, WHISTLE COMMUNICATIONS MAKES NO + * REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS SOFTWARE, + * INCLUDING WITHOUT LIMITATION, ANY AND ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. + * WHISTLE COMMUNICATIONS DOES NOT WARRANT, GUARANTEE, OR MAKE ANY + * REPRESENTATIONS REGARDING THE USE OF, OR THE RESULTS OF THE USE OF THIS + * SOFTWARE IN TERMS OF ITS CORRECTNESS, ACCURACY, RELIABILITY OR OTHERWISE. + * IN NO EVENT SHALL WHISTLE COMMUNICATIONS BE LIABLE FOR ANY DAMAGES + * RESULTING FROM OR ARISING OUT OF ANY USE OF THIS SOFTWARE, INCLUDING + * WITHOUT LIMITATION, ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + * PUNITIVE, OR CONSEQUENTIAL DAMAGES, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES, LOSS OF USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF WHISTLE COMMUNICATIONS IS ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * Author: Archie Cobbs + * + * $FreeBSD: src/lib/libnetgraph/netgraph.h,v 1.4 2004/01/27 20:25:14 ru Exp $ + * $Whistle: netgraph.h,v 1.7 1999/01/20 00:57:23 archie Exp $ + */ + +#ifndef _NETGRAPH_H_ +#define _NETGRAPH_H_ + +#include +#include + +__BEGIN_DECLS +int NgMkSockNode(const char *, int *, int *); +int NgNameNode(int, const char *, const char *, ...) __printflike(3, 4); +int NgSendMsg(int, const char *, int, int, const void *, size_t); +int NgSendAsciiMsg(int, const char *, const char *, ...) __printflike(3, 4); +int NgSendReplyMsg(int, const char *, + const struct ng_mesg *, const void *, size_t); +int NgRecvMsg(int, struct ng_mesg *, size_t, char *); +int NgAllocRecvMsg(int, struct ng_mesg **, char *); +int NgRecvAsciiMsg(int, struct ng_mesg *, size_t, char *); +int NgAllocRecvAsciiMsg(int, struct ng_mesg **, char *); +int NgSendData(int, const char *, const u_char *, size_t); +int NgRecvData(int, u_char *, size_t, char *); +int NgAllocRecvData(int, u_char **, char *); +int NgSetDebug(int); +void NgSetErrLog(void (*)(const char *fmt, ...), + void (*)(const char *fmt, ...)); +__END_DECLS + +#endif + diff --git a/src/include.new/nl_types.h b/src/include.new/nl_types.h new file mode 100644 index 0000000..6951fbd --- /dev/null +++ b/src/include.new/nl_types.h @@ -0,0 +1,108 @@ +/* $NetBSD: nl_types.h,v 1.9 2000/10/03 19:53:32 sommerfeld Exp $ */ + +/*- + * Copyright (c) 1996 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by J.T. Conklin. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the NetBSD + * Foundation, Inc. and its contributors. + * 4. Neither the name of The NetBSD Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * $FreeBSD: src/include/nl_types.h,v 1.11.2.2 2006/02/01 12:24:39 stefanf Exp $ + */ + +#ifndef _NL_TYPES_H_ +#define _NL_TYPES_H_ + +#include +#include + +#ifdef _NLS_PRIVATE +/* + * MESSAGE CATALOG FILE FORMAT. + * + * The NetBSD/FreeBSD message catalog format is similar to the format used by + * Svr4 systems. The differences are: + * * fixed byte order (big endian) + * * fixed data field sizes + * + * A message catalog contains four data types: a catalog header, one + * or more set headers, one or more message headers, and one or more + * text strings. + */ + +#define _NLS_MAGIC 0xff88ff89 + +struct _nls_cat_hdr { + int32_t __magic; + int32_t __nsets; + int32_t __mem; + int32_t __msg_hdr_offset; + int32_t __msg_txt_offset; +} ; + +struct _nls_set_hdr { + int32_t __setno; /* set number: 0 < x <= NL_SETMAX */ + int32_t __nmsgs; /* number of messages in the set */ + int32_t __index; /* index of first msg_hdr in msg_hdr table */ +} ; + +struct _nls_msg_hdr { + int32_t __msgno; /* msg number: 0 < x <= NL_MSGMAX */ + int32_t __msglen; + int32_t __offset; +} ; + +#endif /* _NLS_PRIVATE */ + +#define NL_SETD 0 +#define NL_CAT_LOCALE 1 + +typedef struct __nl_cat_d { + void *__data; + int __size; +} *nl_catd; + +#ifndef _NL_ITEM_DECLARED +typedef __nl_item nl_item; +#define _NL_ITEM_DECLARED +#endif + +__BEGIN_DECLS +nl_catd catopen(const char *, int); +/* Work-around for old */ +#ifndef __format_arg +#define __format_arg(a) __attribute__((__format_arg__(a))) +#endif +char *catgets(nl_catd, int, int, const char *) __format_arg(4); +int catclose(nl_catd); +__END_DECLS + +#endif /* _NL_TYPES_H_ */ diff --git a/src/include.new/nlist.h b/src/include.new/nlist.h new file mode 100644 index 0000000..ec55074 --- /dev/null +++ b/src/include.new/nlist.h @@ -0,0 +1,53 @@ +/*- + * Copyright (c) 1991, 1993 + * The Regents of the University of California. All rights reserved. + * (c) UNIX System Laboratories, Inc. + * All or some portions of this file are derived from material licensed + * to the University of California by American Telephone and Telegraph + * Co. or Unix System Laboratories, Inc. and are reproduced herein with + * the permission of UNIX System Laboratories, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)nlist.h 8.2 (Berkeley) 1/21/94 + * + * $FreeBSD: src/include/nlist.h,v 1.9 2002/08/22 20:37:57 peter Exp $ + */ + +#ifndef _NLIST_H_ +#define _NLIST_H_ + +#include +#include + +__BEGIN_DECLS +int nlist(const char *, struct nlist *); +__END_DECLS + +#endif /* !_NLIST_H_ */ diff --git a/src/include.new/nss.h b/src/include.new/nss.h new file mode 100644 index 0000000..792b16b --- /dev/null +++ b/src/include.new/nss.h @@ -0,0 +1,57 @@ +/*- + * Copyright (c) 2003 Networks Associates Technology, Inc. + * All rights reserved. + * + * This software was developed for the FreeBSD Project by + * Jacques A. Vidrine, Safeport Network Services, and Network + * Associates Laboratories, the Security Research Division of Network + * Associates, Inc. under DARPA/SPAWAR contract N66001-01-C-8035 + * ("CBOSS"), as part of the DARPA CHATS research program. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD: src/include/nss.h,v 1.2 2004/01/09 13:43:49 nectar Exp $ + * + * Compatibility header for the GNU C Library-style nsswitch interface. + */ +#ifndef _NSS_H_ +#define _NSS_H_ + +#include + +enum nss_status { + NSS_STATUS_TRYAGAIN = -2, + NSS_STATUS_UNAVAIL, + NSS_STATUS_NOTFOUND, + NSS_STATUS_SUCCESS, + NSS_STATUS_RETURN +}; + +#define __nss_compat_result(rv, err) \ +((rv == NSS_STATUS_TRYAGAIN && err == ERANGE) ? NS_RETURN : \ + (rv == NSS_STATUS_TRYAGAIN) ? NS_TRYAGAIN : \ + (rv == NSS_STATUS_UNAVAIL) ? NS_UNAVAIL : \ + (rv == NSS_STATUS_NOTFOUND) ? NS_NOTFOUND : \ + (rv == NSS_STATUS_SUCCESS) ? NS_SUCCESS : \ + (rv == NSS_STATUS_RETURN) ? NS_RETURN : 0) + +#endif diff --git a/src/include.new/nsswitch.h b/src/include.new/nsswitch.h new file mode 100644 index 0000000..9936ad1 --- /dev/null +++ b/src/include.new/nsswitch.h @@ -0,0 +1,246 @@ +/* $NetBSD: nsswitch.h,v 1.6 1999/01/26 01:04:07 lukem Exp $ */ +/* $FreeBSD: src/include/nsswitch.h,v 1.3 2003/04/17 14:14:21 nectar Exp $ */ + +/*- + * Copyright (c) 1997, 1998, 1999 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Luke Mewburn. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the NetBSD + * Foundation, Inc. and its contributors. + * 4. Neither the name of The NetBSD Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _NSSWITCH_H +#define _NSSWITCH_H 1 + +#include +#include + +#define NSS_MODULE_INTERFACE_VERSION 1 + +#ifndef _PATH_NS_CONF +#define _PATH_NS_CONF "/etc/nsswitch.conf" +#endif + +/* NSS source actions */ +#define NS_ACTION_CONTINUE 0 /* try the next source */ +#define NS_ACTION_RETURN 1 /* look no further */ + +#define NS_SUCCESS (1<<0) /* entry was found */ +#define NS_UNAVAIL (1<<1) /* source not responding, or corrupt */ +#define NS_NOTFOUND (1<<2) /* source responded 'no such entry' */ +#define NS_TRYAGAIN (1<<3) /* source busy, may respond to retry */ +#define NS_RETURN (1<<4) /* stop search, e.g. for ERANGE */ +#define NS_TERMINATE (NS_SUCCESS|NS_RETURN) /* flags that end search */ +#define NS_STATUSMASK 0x000000ff /* bitmask to get the status flags */ + +/* + * currently implemented sources + */ +#define NSSRC_FILES "files" /* local files */ +#define NSSRC_DNS "dns" /* DNS; IN for hosts, HS for others */ +#define NSSRC_NIS "nis" /* YP/NIS */ +#define NSSRC_COMPAT "compat" /* passwd,group in YP compat mode */ + +/* + * currently implemented databases + */ +#define NSDB_HOSTS "hosts" +#define NSDB_GROUP "group" +#define NSDB_GROUP_COMPAT "group_compat" +#define NSDB_NETGROUP "netgroup" +#define NSDB_NETWORKS "networks" +#define NSDB_PASSWD "passwd" +#define NSDB_PASSWD_COMPAT "passwd_compat" +#define NSDB_SHELLS "shells" + +/* + * suggested databases to implement + */ +#define NSDB_ALIASES "aliases" +#define NSDB_AUTH "auth" +#define NSDB_AUTOMOUNT "automount" +#define NSDB_BOOTPARAMS "bootparams" +#define NSDB_ETHERS "ethers" +#define NSDB_EXPORTS "exports" +#define NSDB_NETMASKS "netmasks" +#define NSDB_PHONES "phones" +#define NSDB_PRINTCAP "printcap" +#define NSDB_PROTOCOLS "protocols" +#define NSDB_REMOTE "remote" +#define NSDB_RPC "rpc" +#define NSDB_SENDMAILVARS "sendmailvars" +#define NSDB_SERVICES "services" +#define NSDB_TERMCAP "termcap" +#define NSDB_TTYS "ttys" + +/* + * ns_dtab `method' function signature. + */ +typedef int (*nss_method)(void *_retval, void *_mdata, va_list _ap); + +/* + * Macro for generating method prototypes. + */ +#define NSS_METHOD_PROTOTYPE(method) \ + int method(void *, void *, va_list) + +/* + * ns_dtab - `nsswitch dispatch table' + * Contains an entry for each source and the appropriate function to + * call. ns_dtabs are used in the nsdispatch() API in order to allow + * the application to override built-in actions. + */ +typedef struct _ns_dtab { + const char *src; /* Source this entry implements */ + nss_method method; /* Method to be called */ + void *mdata; /* Data passed to method */ +} ns_dtab; + +/* + * macros to help build an ns_dtab[] + */ +#define NS_FILES_CB(F,C) { NSSRC_FILES, F, C }, +#define NS_COMPAT_CB(F,C) { NSSRC_COMPAT, F, C }, + +#ifdef HESIOD +# define NS_DNS_CB(F,C) { NSSRC_DNS, F, C }, +#else +# define NS_DNS_CB(F,C) +#endif + +#ifdef YP +# define NS_NIS_CB(F,C) { NSSRC_NIS, F, C }, +#else +# define NS_NIS_CB(F,C) +#endif + +/* + * ns_src - `nsswitch source' + * used by the nsparser routines to store a mapping between a source + * and its dispatch control flags for a given database. + */ +typedef struct _ns_src { + const char *name; + u_int32_t flags; +} ns_src; + + +/* + * default sourcelist (if nsswitch.conf is missing, corrupt, + * or the requested database doesn't have an entry. + */ +extern const ns_src __nsdefaultsrc[]; + +/* + * ns_mtab - NSS method table + * An NSS module provides a mapping from (database name, method name) + * tuples to the nss_method and associated data. + */ +typedef struct _ns_mtab { + const char *database; + const char *name; + nss_method method; + void *mdata; +} ns_mtab; + +/* + * NSS module de-registration, called at module unload. + */ +typedef void (*nss_module_unregister_fn)(ns_mtab *, unsigned int); + +/* + * NSS module registration, called at module load. + */ +typedef ns_mtab *(*nss_module_register_fn)(const char *, unsigned int *, + nss_module_unregister_fn *); + +/* + * Many NSS interfaces follow the getXXnam, getXXid, getXXent pattern. + * Developers are encouraged to use nss_lookup_type where approriate. + */ +enum nss_lookup_type { + nss_lt_name = 1, + nss_lt_id = 2, + nss_lt_all = 3 +}; + +#ifdef _NS_PRIVATE + +/* + * private data structures for back-end nsswitch implementation + */ + +/* + * ns_dbt - `nsswitch database thang' + * for each database in /etc/nsswitch.conf there is a ns_dbt, with its + * name and a list of ns_src's containing the source information. + */ +typedef struct _ns_dbt { + const char *name; /* name of database */ + ns_src *srclist; /* list of sources */ + int srclistsize; /* size of srclist */ +} ns_dbt; + +/* + * ns_mod - NSS module + */ +typedef struct _ns_mod { + char *name; /* module name */ + void *handle; /* handle from dlopen */ + ns_mtab *mtab; /* method table */ + unsigned int mtabsize; /* count of entries in method table */ + nss_module_unregister_fn unregister; /* called to unload module */ +} ns_mod; + +#endif /* _NS_PRIVATE */ + + +#include + +__BEGIN_DECLS +extern int nsdispatch(void *, const ns_dtab [], const char *, + const char *, const ns_src [], ...); + +#ifdef _NS_PRIVATE +extern void _nsdbtaddsrc(ns_dbt *, const ns_src *); +extern void _nsdbtput(const ns_dbt *); +extern void _nsyyerror(const char *); +extern int _nsyylex(void); +extern int _nsyyparse(void); +extern int _nsyylineno; +#ifdef _NSS_DEBUG +extern void _nsdbtdump(const ns_dbt *); +#endif +#endif /* _NS_PRIVATE */ + +__END_DECLS + +#endif /* !_NSSWITCH_H */ diff --git a/src/include.new/objformat.h b/src/include.new/objformat.h new file mode 100644 index 0000000..e894323 --- /dev/null +++ b/src/include.new/objformat.h @@ -0,0 +1,39 @@ +/*- + * Copyright (c) 1998 John D. Polstra + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD: src/include/objformat.h,v 1.2 1999/08/27 23:44:51 peter Exp $ + */ + +#ifndef _OBJFORMAT_H_ +#define _OBJFORMAT_H_ + +#include +#include + +__BEGIN_DECLS +int getobjformat(char *, size_t, int *, char **); +__END_DECLS + +#endif /* _OBJFORMAT_H_ */ diff --git a/src/include.new/opie.h b/src/include.new/opie.h new file mode 100644 index 0000000..a3fe84f --- /dev/null +++ b/src/include.new/opie.h @@ -0,0 +1,175 @@ +/* opie.h: Data structures and values for the OPIE authentication + system that a program might need. + +%%% portions-copyright-cmetz-96 +Portions of this software are Copyright 1996-1999 by Craig Metz, All Rights +Reserved. The Inner Net License Version 2 applies to these portions of +the software. +You should have received a copy of the license with this software. If +you didn't get a copy, you may request one from . + +Portions of this software are Copyright 1995 by Randall Atkinson and Dan +McDonald, All Rights Reserved. All Rights under this copyright are assigned +to the U.S. Naval Research Laboratory (NRL). The NRL Copyright Notice and +License Agreement applies to this software. + + History: + + Modified by cmetz for OPIE 2.4. Added sequence number limits. Added + struct opie_otpkey and made many functions use it. Added + opiestrncpy(). Include header with libmissing prototypes. + Modified by cmetz for OPIE 2.32. Added symbolic flag names for + opiepasswd(). Added __opieparsechallenge() prototype. + Modified by cmetz for OPIE 2.31. Removed active attack protection. + Modified by cmetz for OPIE 2.3. Renamed PTR to VOIDPTR. Added + re-init key and extension file fields to struct opie. Added + opie_ prefix on struct opie members. Added opie_flags field + and definitions. Added more prototypes. Changed opiehash() + prototype. + Modified by cmetz for OPIE 2.22. Define __P correctly if this file + is included in a third-party program. + Modified by cmetz for OPIE 2.2. Re-did prototypes. Added FUNCTION + definition et al. Multiple-include protection. Added struct + utsname fake. Got rid of gethostname() cruft. Moved UINT4 + here. Provide for *seek whence values. Move MDx context here + and unify. Re-did prototypes. + Modified at NRL for OPIE 2.0. + Written at Bellcore for the S/Key Version 1 software distribution + (skey.h). + +$FreeBSD: src/contrib/opie/opie.h,v 1.8 2002/03/21 23:42:52 markm Exp $ +*/ +#ifndef _OPIE_H +#define _OPIE_H 1 + +struct opie { + int opie_flags; + char opie_buf[256]; + char *opie_principal; + int opie_n; + char *opie_seed; + char *opie_val; + long opie_recstart; +}; + +#define __OPIE_FLAGS_RW 1 +#define __OPIE_FLAGS_READ 2 + +/* Minimum length of a secret password */ +#ifndef OPIE_SECRET_MIN +#define OPIE_SECRET_MIN 10 +#endif /* OPIE_SECRET_MIN */ + +/* Maximum length of a secret password */ +#define OPIE_SECRET_MAX 127 + +/* Minimum length of a seed */ +#define OPIE_SEED_MIN 5 + +/* Maximum length of a seed */ +#define OPIE_SEED_MAX 16 + +/* Max length of hash algorithm name (md4/md5) */ +#define OPIE_HASHNAME_MAX 3 + +/* Maximum length of a challenge (otp-md? 9999 seed) */ +#define OPIE_CHALLENGE_MAX (4+OPIE_HASHNAME_MAX+1+4+1+OPIE_SEED_MAX) + +/* Maximum length of a response that we allow */ +#define OPIE_RESPONSE_MAX (9+1+19+1+9+OPIE_SEED_MAX+1+19+1+19+1+19) + +/* Maximum length of a principal (read: user name) */ +#define OPIE_PRINCIPAL_MAX 32 + +/* Maximum sequence number */ +#ifndef OPIE_SEQUENCE_MAX +#define OPIE_SEQUENCE_MAX 9999 +#endif /* OPIE_SEQUENCE_MAX */ + +/* Restricted sequence number */ +#ifndef OPIE_SEQUENCE_RESTRICT +#define OPIE_SEQUENCE_RESTRICT 9 +#endif /* OPIE_SEQUENCE_RESTRICT */ + +#define UINT4 u_int32_t + +struct opie_otpkey { + UINT4 words[2]; +}; + +#ifndef SEEK_SET +#define SEEK_SET 0 +#endif /* SEEK_SET */ + +#ifndef SEEK_END +#define SEEK_END 2 +#endif /* SEEK_END */ + +__BEGIN_DECLS +int opieaccessfile __P((char *)); +int rdnets __P((long)); +int isaddr __P((register char *)); +int opiealways __P((char *)); +char *opieatob8 __P((struct opie_otpkey *, char *)); +void opiebackspace __P((char *)); +char *opiebtoa8 __P((char *, struct opie_otpkey *)); +char *opiebtoe __P((char *, struct opie_otpkey *)); +char *opiebtoh __P((char *, struct opie_otpkey *)); +int opieetob __P((struct opie_otpkey *, char *)); +int opiechallenge __P((struct opie *,char *,char *)); +int opiegenerator __P((char *,char *,char *)); +int opiegetsequence __P((struct opie *)); +void opiehash __P((struct opie_otpkey *, unsigned)); +int opiehtoi __P((register char)); +int opiekeycrunch __P((int, struct opie_otpkey *, char *, char *)); +int opielock __P((char *)); +int opieunlock __P((void)); +void opieunlockaeh __P((void)); +void opiedisableaeh __P((void)); +int opielookup __P((struct opie *,char *)); +int opiepasscheck __P((char *)); +void opierandomchallenge __P((char *)); +char * opieskipspace __P((register char *)); +void opiestripcrlf __P((char *)); +int opieverify __P((struct opie *,char *)); +int opiepasswd __P((struct opie *, int, char *, int, char *, char *)); +char *opiereadpass __P((char *, int, int)); +int opielogin __P((char *line, char *name, char *host)); +const char *opie_get_algorithm __P((void)); +int opie_haskey __P((char *username)); +char *opie_keyinfo __P((char *)); +int opie_passverify __P((char *username, char *passwd)); +__END_DECLS + +#if _OPIE +#define VOIDPTR void * +#define VOIDRET void +#define NOARGS void +#define FUNCTION(arglist, args) (args) +#define AND , +#define FUNCTION_NOARGS () + +__BEGIN_DECLS +struct utmp; +int __opiegetutmpentry __P((char *, struct utmp *)); +#ifdef EOF +FILE *__opieopen __P((char *, int, int)); +#endif /* EOF */ +int __opiereadrec __P((struct opie *)); +int __opiewriterec __P((struct opie *)); +int __opieparsechallenge __P((char *buffer, int *algorithm, int *sequence, char **seed, int *exts)); +__END_DECLS + +#define opiestrncpy(dst, src, n) \ + do { \ + strncpy(dst, src, n-1); \ + dst[n-1] = 0; \ + } while(0) + +/* #include "missing.h" */ +#endif /* _OPIE */ + +#define OPIEPASSWD_CONSOLE 1 +#define OPIEPASSWD_FORCE 2 + +#endif /* _OPIE_H */ diff --git a/src/include.new/osreldate.h b/src/include.new/osreldate.h new file mode 100644 index 0000000..0d7396b --- /dev/null +++ b/src/include.new/osreldate.h @@ -0,0 +1,33 @@ +/*- + * Copyright (c) 1992-2006 The FreeBSD Project. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + */ + +#ifdef _KERNEL +#error " cannot be used in the kernel, use " +#else +#undef __FreeBSD_version +#define __FreeBSD_version 602100 +#endif diff --git a/src/include.new/panel.h b/src/include.new/panel.h new file mode 100644 index 0000000..3b8542a --- /dev/null +++ b/src/include.new/panel.h @@ -0,0 +1,75 @@ +/**************************************************************************** + * Copyright (c) 1998,2000 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Zeyd M. Ben-Halim 1995 * + * and: Eric S. Raymond * + ****************************************************************************/ + +/* panel.h -- interface file for panels library */ + +#ifndef NCURSES_PANEL_H_incl +#define NCURSES_PANEL_H_incl 1 + +#include + +typedef struct panel +{ + WINDOW *win; + struct panel *below; + struct panel *above; + NCURSES_CONST void *user; +} PANEL; + +#if defined(__cplusplus) +extern "C" { +#endif + +extern NCURSES_EXPORT(WINDOW*) panel_window (const PANEL *); +extern NCURSES_EXPORT(void) update_panels (void); +extern NCURSES_EXPORT(int) hide_panel (PANEL *); +extern NCURSES_EXPORT(int) show_panel (PANEL *); +extern NCURSES_EXPORT(int) del_panel (PANEL *); +extern NCURSES_EXPORT(int) top_panel (PANEL *); +extern NCURSES_EXPORT(int) bottom_panel (PANEL *); +extern NCURSES_EXPORT(PANEL*) new_panel (WINDOW *); +extern NCURSES_EXPORT(PANEL*) panel_above (const PANEL *); +extern NCURSES_EXPORT(PANEL*) panel_below (const PANEL *); +extern NCURSES_EXPORT(int) set_panel_userptr (PANEL *, NCURSES_CONST void *); +extern NCURSES_EXPORT(NCURSES_CONST void*) panel_userptr (const PANEL *); +extern NCURSES_EXPORT(int) move_panel (PANEL *, int, int); +extern NCURSES_EXPORT(int) replace_panel (PANEL *,WINDOW *); +extern NCURSES_EXPORT(int) panel_hidden (const PANEL *); + +#if defined(__cplusplus) +} +#endif + +#endif /* NCURSES_PANEL_H_incl */ + +/* end of panel.h */ diff --git a/src/include.new/paths.h b/src/include.new/paths.h new file mode 100644 index 0000000..952a3ae --- /dev/null +++ b/src/include.new/paths.h @@ -0,0 +1,139 @@ +/* + * Copyright (c) 1989, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)paths.h 8.1 (Berkeley) 6/2/93 + * $FreeBSD: src/include/paths.h,v 1.25 2004/01/04 17:17:46 iedowse Exp $ + */ + +#ifndef _PATHS_H_ +#define _PATHS_H_ + +#include + +/* Default search path. */ +#define _PATH_DEFPATH "/usr/bin:/bin" +/* All standard utilities path. */ +#define _PATH_STDPATH \ + "/usr/bin:/bin:/usr/sbin:/sbin:" +/* Locate system binaries */ +#define _PATH_SYSPATH \ + "/sbin:/usr/sbin" + +#define _PATH_AUTHCONF "/etc/auth.conf" +#define _PATH_BSHELL "/bin/sh" +#define _PATH_CAPABILITY "/etc/capability" +#define _PATH_CAPABILITY_DB "/etc/capability.db" +#define _PATH_CONSOLE "/dev/console" +#define _PATH_CP "/bin/cp" +#define _PATH_CSHELL "/bin/csh" +#define _PATH_DEFTAPE "/dev/sa0" +#define _PATH_DEVNULL "/dev/null" +#define _PATH_DEVZERO "/dev/zero" +#define _PATH_DRUM "/dev/drum" +#define _PATH_ETC "/etc" +#define _PATH_FTPUSERS "/etc/ftpusers" +#define _PATH_HALT "/sbin/halt" +#define _PATH_IFCONFIG "/sbin/ifconfig" +#define _PATH_KMEM "/dev/kmem" +#define _PATH_LIBMAP_CONF "/etc/libmap.conf" +#define _PATH_LOCALE "/usr/share/locale" +#define _PATH_LOGIN "/usr/bin/login" +#define _PATH_MAILDIR "/var/mail" +#define _PATH_MAN "/usr/share/man" +#define _PATH_MDCONFIG "/sbin/mdconfig" +#define _PATH_MEM "/dev/mem" +#define _PATH_MKSNAP_FFS "/sbin/mksnap_ffs" +#define _PATH_MOUNT "/sbin/mount" +#define _PATH_NEWFS "/sbin/newfs" +#define _PATH_NOLOGIN "/var/run/nologin" +#define _PATH_RCP "/bin/rcp" +#define _PATH_REBOOT "/sbin/reboot" +#define _PATH_RLOGIN "/usr/bin/rlogin" +#define _PATH_RM "/bin/rm" +#define _PATH_RSH "/usr/bin/rsh" +#define _PATH_SENDMAIL "/usr/sbin/sendmail" +#define _PATH_SHELLS "/etc/shells" +#define _PATH_TTY "/dev/tty" +#define _PATH_UNIX "don't use _PATH_UNIX" +#define _PATH_VI "/usr/bin/vi" +#define _PATH_WALL "/usr/bin/wall" + +/* Provide trailing slash, since mostly used for building pathnames. */ +#define _PATH_DEV "/dev/" +#define _PATH_TMP "/tmp/" +#define _PATH_VARDB "/var/db/" +#define _PATH_VARRUN "/var/run/" +#define _PATH_VARTMP "/var/tmp/" +#define _PATH_YP "/var/yp/" +#define _PATH_UUCPLOCK "/var/spool/lock/" + +/* How to get the correct name of the kernel. */ +__BEGIN_DECLS +const char *getbootfile(void); +__END_DECLS + +#ifdef RESCUE +#undef _PATH_DEFPATH +#define _PATH_DEFPATH "/rescue:/usr/bin:/bin" +#undef _PATH_STDPATH +#define _PATH_STDPATH "/rescue:/usr/bin:/bin:/usr/sbin:/sbin" +#undef _PATH_SYSPATH +#define _PATH_SYSPATH "/rescue:/sbin:/usr/sbin" +#undef _PATH_BSHELL +#define _PATH_BSHELL "/rescue/sh" +#undef _PATH_CP +#define _PATH_CP "/rescue/cp" +#undef _PATH_CSHELL +#define _PATH_CSHELL "/rescue/csh" +#undef _PATH_HALT +#define _PATH_HALT "/rescue/halt" +#undef _PATH_IFCONFIG +#define _PATH_IFCONFIG "/rescue/ifconfig" +#undef _PATH_MDCONFIG +#define _PATH_MDCONFIG "/rescue/mdconfig" +#undef _PATH_MOUNT +#define _PATH_MOUNT "/rescue/mount" +#undef _PATH_NEWFS +#define _PATH_NEWFS "/rescue/newfs" +#undef _PATH_RCP +#define _PATH_RCP "/rescue/rcp" +#undef _PATH_REBOOT +#define _PATH_REBOOT "/rescue/reboot" +#undef _PATH_RM +#define _PATH_RM "/rescue/rm" +#undef _PATH_VI +#define _PATH_VI "/rescue/vi" +#undef _PATH_WALL +#define _PATH_WALL "/rescue/wall" +#endif /* RESCUE */ + +#endif /* !_PATHS_H_ */ diff --git a/src/include.new/pcap-int.h b/src/include.new/pcap-int.h new file mode 100644 index 0000000..11b6665 --- /dev/null +++ b/src/include.new/pcap-int.h @@ -0,0 +1,303 @@ +/* + * Copyright (c) 1994, 1995, 1996 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the Computer Systems + * Engineering Group at Lawrence Berkeley Laboratory. + * 4. Neither the name of the University nor of the Laboratory may be used + * to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD: src/contrib/libpcap/pcap-int.h,v 1.11 2005/07/11 03:43:25 sam Exp $ + * @(#) $Header$ (LBL) + */ + +#ifndef pcap_int_h +#define pcap_int_h + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#ifdef WIN32 +#include +#endif /* WIN32 */ + +#ifdef MSDOS +#include +#include +#endif + +/* + * Savefile + */ +typedef enum { + NOT_SWAPPED, + SWAPPED, + MAYBE_SWAPPED +} swapped_type_t; + +struct pcap_sf { + FILE *rfile; + int swapped; + int hdrsize; + swapped_type_t lengths_swapped; + int version_major; + int version_minor; + u_char *base; +}; + +struct pcap_md { + struct pcap_stat stat; + /*XXX*/ + int use_bpf; /* using kernel filter */ + u_long TotPkts; /* can't oflow for 79 hrs on ether */ + u_long TotAccepted; /* count accepted by filter */ + u_long TotDrops; /* count of dropped packets */ + long TotMissed; /* missed by i/f during this run */ + long OrigMissed; /* missed by i/f before this run */ + char *device; /* device name */ +#ifdef linux + int sock_packet; /* using Linux 2.0 compatible interface */ + int timeout; /* timeout specified to pcap_open_live */ + int clear_promisc; /* must clear promiscuous mode when we close */ + int cooked; /* using SOCK_DGRAM rather than SOCK_RAW */ + int ifindex; /* interface index of device we're bound to */ + int lo_ifindex; /* interface index of the loopback device */ + struct pcap *next; /* list of open promiscuous sock_packet pcaps */ +#endif + +#ifdef HAVE_DAG_API + void *dag_mem_base; /* DAG card memory base address */ + u_int dag_mem_bottom; /* DAG card current memory bottom pointer */ + u_int dag_mem_top; /* DAG card current memory top pointer */ + int dag_fcs_bits; /* Number of checksum bits from link layer */ + int dag_offset_flags; /* Flags to pass to dag_offset(). */ +#endif +}; + +/* + * 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 + * Tru64 UNIX, and NetBSD pad to make everything line up on a nice boundary. + */ +#if defined(ultrix) || defined(__osf__) || (defined(__NetBSD__) && __NetBSD_Version__ > 106000000) +#define PCAP_FDDIPAD 3 +#endif + +struct pcap { +#ifdef WIN32 + ADAPTER *adapter; + LPPACKET Packet; + int timeout; + int nonblock; +#else + int fd; + int selectable_fd; + int send_fd; +#endif /* WIN32 */ + int snapshot; + int linktype; + int tzoff; /* timezone offset */ + int offset; /* offset for proper alignment */ + + int break_loop; /* flag set to force break from packet-reading loop */ + +#ifdef PCAP_FDDIPAD + int fddipad; +#endif + +#ifdef MSDOS + int inter_packet_wait; /* offline: wait between packets */ + void (*wait_proc)(void); /* call proc while waiting */ +#endif + + struct pcap_sf sf; + struct pcap_md md; + + /* + * Read buffer. + */ + int bufsize; + u_char *buffer; + u_char *bp; + int cc; + + /* + * Place holder for pcap_next(). + */ + u_char *pkt; + + /* We're accepting only packets in this direction/these directions. */ + direction_t direction; + + /* + * Methods. + */ + int (*read_op)(pcap_t *, int cnt, pcap_handler, u_char *); + int (*inject_op)(pcap_t *, const void *, size_t); + int (*setfilter_op)(pcap_t *, struct bpf_program *); + int (*setdirection_op)(pcap_t *, direction_t); + int (*set_datalink_op)(pcap_t *, int); + int (*getnonblock_op)(pcap_t *, char *); + int (*setnonblock_op)(pcap_t *, int, char *); + int (*stats_op)(pcap_t *, struct pcap_stat *); + void (*close_op)(pcap_t *); + + /* + * Placeholder for filter code if bpf not in kernel. + */ + struct bpf_program fcode; + + char errbuf[PCAP_ERRBUF_SIZE + 1]; + int dlt_count; + u_int *dlt_list; + + struct pcap_pkthdr pcap_header; /* This is needed for the pcap_next_ex() to work */ +}; + +/* + * This is a timeval as stored in disk in a dumpfile. + * It has to use the same types everywhere, independent of the actual + * `struct timeval' + */ + +struct pcap_timeval { + bpf_int32 tv_sec; /* seconds */ + bpf_int32 tv_usec; /* microseconds */ +}; + +/* + * How a `pcap_pkthdr' is actually stored in the dumpfile. + * + * Do not change the format of this structure, in any way (this includes + * changes that only affect the length of fields in this structure), + * and do not make the time stamp anything other than seconds and + * microseconds (e.g., seconds and nanoseconds). Instead: + * + * introduce a new structure for the new format; + * + * send mail to "tcpdump-workers@tcpdump.org", requesting a new + * magic number for your new capture file format, and, when + * you get the new magic number, put it in "savefile.c"; + * + * use that magic number for save files with the changed record + * header; + * + * make the code in "savefile.c" capable of reading files with + * the old record header as well as files with the new record header + * (using the magic number to determine the header format). + * + * Then supply the changes to "patches@tcpdump.org", so that future + * versions of libpcap and programs that use it (such as tcpdump) will + * be able to read your new capture file format. + */ + +struct pcap_sf_pkthdr { + struct pcap_timeval ts; /* time stamp */ + bpf_u_int32 caplen; /* length of portion present */ + bpf_u_int32 len; /* length this packet (off wire) */ +}; + +/* + * How a `pcap_pkthdr' is actually stored in dumpfiles written + * by some patched versions of libpcap (e.g. the ones in Red + * Hat Linux 6.1 and 6.2). + * + * Do not change the format of this structure, in any way (this includes + * changes that only affect the length of fields in this structure). + * Instead, introduce a new structure, as per the above. + */ + +struct pcap_sf_patched_pkthdr { + struct pcap_timeval ts; /* time stamp */ + bpf_u_int32 caplen; /* length of portion present */ + bpf_u_int32 len; /* length this packet (off wire) */ + int index; + unsigned short protocol; + unsigned char pkt_type; +}; + +int yylex(void); + +#ifndef min +#define min(a, b) ((a) > (b) ? (b) : (a)) +#endif + +/* XXX should these be in pcap.h? */ +int pcap_offline_read(pcap_t *, int, pcap_handler, u_char *); +int pcap_read(pcap_t *, int cnt, pcap_handler, u_char *); + +#ifndef HAVE_STRLCPY +#define strlcpy(x, y, z) \ + (strncpy((x), (y), (z)), \ + ((z) <= 0 ? 0 : ((x)[(z) - 1] = '\0')), \ + strlen((y))) +#endif + +#include + +/* + * Routines that most pcap implementations can use for non-blocking mode. + */ +#if !defined(WIN32) && !defined(MSDOS) +int pcap_getnonblock_fd(pcap_t *, char *); +int pcap_setnonblock_fd(pcap_t *p, int, char *); +#endif + +void pcap_close_common(pcap_t *); + +/* + * Internal interfaces for "pcap_findalldevs()". + * + * "pcap_platform_finddevs()" is a platform-dependent routine to + * add devices not found by the "standard" mechanisms (SIOCGIFCONF, + * "getifaddrs()", etc.. + * + * "pcap_add_if()" adds an interface to the list of interfaces. + */ +int pcap_platform_finddevs(pcap_if_t **, char *); +int add_addr_to_iflist(pcap_if_t **, const char *, u_int, struct sockaddr *, + size_t, struct sockaddr *, size_t, struct sockaddr *, size_t, + struct sockaddr *, size_t, char *); +int pcap_add_if(pcap_if_t **, const char *, u_int, const char *, char *); +struct sockaddr *dup_sockaddr(struct sockaddr *, size_t); +int add_or_find_if(pcap_if_t **, pcap_if_t **, const char *, u_int, + const char *, char *); + +#ifdef WIN32 +char *pcap_win32strerror(void); +#endif + +int install_bpf_program(pcap_t *, struct bpf_program *); + +int pcap_strcasecmp(const char *, const char *); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/src/include.new/pcap-namedb.h b/src/include.new/pcap-namedb.h new file mode 100644 index 0000000..9fd846e --- /dev/null +++ b/src/include.new/pcap-namedb.h @@ -0,0 +1,90 @@ +/* + * Copyright (c) 1994, 1996 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the Computer Systems + * Engineering Group at Lawrence Berkeley Laboratory. + * 4. Neither the name of the University nor of the Laboratory may be used + * to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD: src/contrib/libpcap/pcap-namedb.h,v 1.6 2005/07/11 03:43:25 sam Exp $ + * @(#) $Header$ (LBL) + */ + +#ifndef lib_pcap_namedb_h +#define lib_pcap_namedb_h + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * As returned by the pcap_next_etherent() + * XXX this stuff doesn't belong in this interface, but this + * library already must do name to address translation, so + * on systems that don't have support for /etc/ethers, we + * export these hooks since they'll + */ +struct pcap_etherent { + u_char addr[6]; + char name[122]; +}; +#ifndef PCAP_ETHERS_FILE +#define PCAP_ETHERS_FILE "/etc/ethers" +#endif +struct pcap_etherent *pcap_next_etherent(FILE *); +u_char *pcap_ether_hostton(const char*); +u_char *pcap_ether_aton(const char *); + +bpf_u_int32 **pcap_nametoaddr(const char *); +#ifdef INET6 +struct addrinfo *pcap_nametoaddrinfo(const char *); +#endif +bpf_u_int32 pcap_nametonetaddr(const char *); + +int pcap_nametoport(const char *, int *, int *); +int pcap_nametoportrange(const char *, int *, int *, int *); +int pcap_nametoproto(const char *); +int pcap_nametoeproto(const char *); +int pcap_nametollc(const char *); +/* + * If a protocol is unknown, PROTO_UNDEF is returned. + * Also, pcap_nametoport() returns the protocol along with the port number. + * If there are ambiguous entried in /etc/services (i.e. domain + * can be either tcp or udp) PROTO_UNDEF is returned. + */ +#define PROTO_UNDEF -1 + +/* XXX move these to pcap-int.h? */ +int __pcap_atodn(const char *, bpf_u_int32 *); +int __pcap_atoin(const char *, bpf_u_int32 *); +u_short __pcap_nametodnaddr(const char *); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/src/include.new/pcap.h b/src/include.new/pcap.h new file mode 100644 index 0000000..3f3db21 --- /dev/null +++ b/src/include.new/pcap.h @@ -0,0 +1,309 @@ +/* -*- Mode: c; tab-width: 8; indent-tabs-mode: 1; c-basic-offset: 8; -*- */ +/* + * Copyright (c) 1993, 1994, 1995, 1996, 1997 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the Computer Systems + * Engineering Group at Lawrence Berkeley Laboratory. + * 4. Neither the name of the University nor of the Laboratory may be used + * to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD: src/contrib/libpcap/pcap.h,v 1.11 2005/07/11 03:43:25 sam Exp $ + * @(#) $Header$ (LBL) + */ + +#ifndef lib_pcap_h +#define lib_pcap_h + +#include +#include + +#include + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#define PCAP_VERSION_MAJOR 2 +#define PCAP_VERSION_MINOR 4 + +#define PCAP_ERRBUF_SIZE 256 + +/* + * Compatibility for systems that have a bpf.h that + * predates the bpf typedefs for 64-bit support. + */ +#if BPF_RELEASE - 0 < 199406 +typedef int bpf_int32; +typedef u_int bpf_u_int32; +#endif + +typedef struct pcap pcap_t; +typedef struct pcap_dumper pcap_dumper_t; +typedef struct pcap_if pcap_if_t; +typedef struct pcap_addr pcap_addr_t; + +/* + * The first record in the file contains saved values for some + * of the flags used in the printout phases of tcpdump. + * Many fields here are 32 bit ints so compilers won't insert unwanted + * padding; these files need to be interchangeable across architectures. + * + * Do not change the layout of this structure, in any way (this includes + * changes that only affect the length of fields in this structure). + * + * Also, do not change the interpretation of any of the members of this + * structure, in any way (this includes using values other than + * LINKTYPE_ values, as defined in "savefile.c", in the "linktype" + * field). + * + * Instead: + * + * introduce a new structure for the new format, if the layout + * of the structure changed; + * + * send mail to "tcpdump-workers@tcpdump.org", requesting a new + * magic number for your new capture file format, and, when + * you get the new magic number, put it in "savefile.c"; + * + * use that magic number for save files with the changed file + * header; + * + * make the code in "savefile.c" capable of reading files with + * the old file header as well as files with the new file header + * (using the magic number to determine the header format). + * + * Then supply the changes to "patches@tcpdump.org", so that future + * versions of libpcap and programs that use it (such as tcpdump) will + * be able to read your new capture file format. + */ +struct pcap_file_header { + bpf_u_int32 magic; + u_short version_major; + u_short version_minor; + bpf_int32 thiszone; /* gmt to local correction */ + bpf_u_int32 sigfigs; /* accuracy of timestamps */ + bpf_u_int32 snaplen; /* max length saved portion of each pkt */ + bpf_u_int32 linktype; /* data link type (LINKTYPE_*) */ +}; + +typedef enum { + D_INOUT = 0, + D_IN, + D_OUT +} direction_t; + +/* + * Each packet in the dump file is prepended with this generic header. + * This gets around the problem of different headers for different + * packet interfaces. + */ +struct pcap_pkthdr { + struct timeval ts; /* time stamp */ + bpf_u_int32 caplen; /* length of portion present */ + bpf_u_int32 len; /* length this packet (off wire) */ +}; + +/* + * As returned by the pcap_stats() + */ +struct pcap_stat { + u_int ps_recv; /* number of packets received */ + u_int ps_drop; /* number of packets dropped */ + u_int ps_ifdrop; /* drops by interface XXX not yet supported */ +#ifdef WIN32 + u_int bs_capt; /* number of packets that reach the application */ +#endif /* WIN32 */ +}; + +#ifdef MSDOS +/* + * As returned by the pcap_stats_ex() + */ +struct pcap_stat_ex { + u_long rx_packets; /* total packets received */ + u_long tx_packets; /* total packets transmitted */ + u_long rx_bytes; /* total bytes received */ + u_long tx_bytes; /* total bytes transmitted */ + u_long rx_errors; /* bad packets received */ + u_long tx_errors; /* packet transmit problems */ + u_long rx_dropped; /* no space in Rx buffers */ + u_long tx_dropped; /* no space available for Tx */ + u_long multicast; /* multicast packets received */ + u_long collisions; + + /* detailed rx_errors: */ + u_long rx_length_errors; + u_long rx_over_errors; /* receiver ring buff overflow */ + u_long rx_crc_errors; /* recv'd pkt with crc error */ + u_long rx_frame_errors; /* recv'd frame alignment error */ + u_long rx_fifo_errors; /* recv'r fifo overrun */ + u_long rx_missed_errors; /* recv'r missed packet */ + + /* detailed tx_errors */ + u_long tx_aborted_errors; + u_long tx_carrier_errors; + u_long tx_fifo_errors; + u_long tx_heartbeat_errors; + u_long tx_window_errors; + }; +#endif + +/* + * Item in a list of interfaces. + */ +struct pcap_if { + struct pcap_if *next; + char *name; /* name to hand to "pcap_open_live()" */ + char *description; /* textual description of interface, or NULL */ + struct pcap_addr *addresses; + bpf_u_int32 flags; /* PCAP_IF_ interface flags */ +}; + +#define PCAP_IF_LOOPBACK 0x00000001 /* interface is loopback */ + +/* + * Representation of an interface address. + */ +struct pcap_addr { + struct pcap_addr *next; + struct sockaddr *addr; /* address */ + struct sockaddr *netmask; /* netmask for that address */ + struct sockaddr *broadaddr; /* broadcast address for that address */ + struct sockaddr *dstaddr; /* P2P destination address for that address */ +}; + +typedef void (*pcap_handler)(u_char *, const struct pcap_pkthdr *, + const u_char *); + +char *pcap_lookupdev(char *); +int pcap_lookupnet(const char *, bpf_u_int32 *, bpf_u_int32 *, char *); +pcap_t *pcap_open_live(const char *, int, int, int, char *); +pcap_t *pcap_open_dead(int, int); +pcap_t *pcap_open_offline(const char *, char *); +pcap_t *pcap_fopen_offline(FILE *, char *); +void pcap_close(pcap_t *); +int pcap_loop(pcap_t *, int, pcap_handler, u_char *); +int pcap_dispatch(pcap_t *, int, pcap_handler, u_char *); +const u_char* + pcap_next(pcap_t *, struct pcap_pkthdr *); +int pcap_next_ex(pcap_t *, struct pcap_pkthdr **, const u_char **); +void pcap_breakloop(pcap_t *); +int pcap_stats(pcap_t *, struct pcap_stat *); +int pcap_setfilter(pcap_t *, struct bpf_program *); +int pcap_setdirection(pcap_t *, direction_t); +int pcap_getnonblock(pcap_t *, char *); +int pcap_setnonblock(pcap_t *, int, char *); +void pcap_perror(pcap_t *, char *); +int pcap_inject(pcap_t *, const void *, size_t); +int pcap_sendpacket(pcap_t *, const u_char *, int); +char *pcap_strerror(int); +char *pcap_geterr(pcap_t *); +int pcap_compile(pcap_t *, struct bpf_program *, char *, int, + bpf_u_int32); +int pcap_compile_nopcap(int, int, struct bpf_program *, + char *, int, bpf_u_int32); +void pcap_freecode(struct bpf_program *); +int pcap_datalink(pcap_t *); +int pcap_list_datalinks(pcap_t *, int **); +int pcap_set_datalink(pcap_t *, int); +int pcap_datalink_name_to_val(const char *); +const char *pcap_datalink_val_to_name(int); +const char *pcap_datalink_val_to_description(int); +int pcap_snapshot(pcap_t *); +int pcap_is_swapped(pcap_t *); +int pcap_major_version(pcap_t *); +int pcap_minor_version(pcap_t *); + +/* XXX */ +FILE *pcap_file(pcap_t *); +int pcap_fileno(pcap_t *); + +pcap_dumper_t *pcap_dump_open(pcap_t *, const char *); +pcap_dumper_t *pcap_dump_fopen(pcap_t *, FILE *fp); +FILE *pcap_dump_file(pcap_dumper_t *); +long pcap_dump_ftell(pcap_dumper_t *); +int pcap_dump_flush(pcap_dumper_t *); +void pcap_dump_close(pcap_dumper_t *); +void pcap_dump(u_char *, const struct pcap_pkthdr *, const u_char *); + +int pcap_findalldevs(pcap_if_t **, char *); +void pcap_freealldevs(pcap_if_t *); + +const char *pcap_lib_version(void); + +/* XXX this guy lives in the bpf tree */ +u_int bpf_filter(struct bpf_insn *, u_char *, u_int, u_int); +int bpf_validate(struct bpf_insn *f, int len); +char *bpf_image(struct bpf_insn *, int); +void bpf_dump(struct bpf_program *, int); + +#if defined(WIN32) + +/* + * Win32 definitions + */ + +int pcap_setbuff(pcap_t *p, int dim); +int pcap_setmode(pcap_t *p, int mode); +int pcap_setmintocopy(pcap_t *p, int size); + +#ifdef WPCAP +/* Include file with the wpcap-specific extensions */ +#include +#endif /* WPCAP */ + +#define MODE_CAPT 0 +#define MODE_STAT 1 +#define MODE_MON 2 + +#elif defined(MSDOS) + +/* + * MS-DOS definitions + */ + +int pcap_stats_ex (pcap_t *, struct pcap_stat_ex *); +void pcap_set_wait (pcap_t *p, void (*yield)(void), int wait); +u_long pcap_mac_packets (void); + +#else /* UN*X */ + +/* + * UN*X definitions + */ + +int pcap_get_selectable_fd(pcap_t *); + +#endif /* WIN32/MSDOS/UN*X */ + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/src/include.new/pmc.h b/src/include.new/pmc.h new file mode 100644 index 0000000..eb1e19d --- /dev/null +++ b/src/include.new/pmc.h @@ -0,0 +1,109 @@ +/*- + * Copyright (c) 2003,2004 Joseph Koshy + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD: src/lib/libpmc/pmc.h,v 1.3 2005/06/09 19:45:06 jkoshy Exp $ + */ + +#ifndef _PMC_H_ +#define _PMC_H_ + +#include + +/* + * Driver statistics. + */ +struct pmc_driverstats { + int pm_intr_ignored; /* #interrupts ignored */ + int pm_intr_processed; /* #interrupts processed */ + int pm_intr_bufferfull; /* #interrupts with ENOSPC */ + int pm_syscalls; /* #syscalls */ + int pm_syscall_errors; /* #syscalls with errors */ + int pm_buffer_requests; /* #buffer requests */ + int pm_buffer_requests_failed; /* #failed buffer requests */ + int pm_log_sweeps; /* #sample buffer processing passes */ +}; + +/* + * CPU information. + */ +struct pmc_cpuinfo { + enum pmc_cputype pm_cputype; /* the kind of CPU */ + uint32_t pm_ncpu; /* number of CPUs */ + uint32_t pm_npmc; /* #PMCs per CPU */ + uint32_t pm_nclass; /* #classes of PMCs */ + struct pmc_classinfo pm_classes[PMC_CLASS_MAX]; +}; + +/* + * Current PMC state. + */ +struct pmc_pmcinfo { + int32_t pm_cpu; /* CPU number */ + struct pmc_info pm_pmcs[]; /* NPMC structs */ +}; + +/* + * Prototypes + */ + +int pmc_allocate(const char *_ctrspec, enum pmc_mode _mode, uint32_t _flags, + int _cpu, pmc_id_t *_pmcid); +int pmc_attach(pmc_id_t _pmcid, pid_t _pid); +int pmc_capabilities(pmc_id_t _pmc, uint32_t *_caps); +int pmc_configure_logfile(int _fd); +int pmc_flush_logfile(void); +int pmc_detach(pmc_id_t _pmcid, pid_t _pid); +int pmc_disable(int _cpu, int _pmc); +int pmc_enable(int _cpu, int _pmc); +int pmc_get_driver_stats(struct pmc_driverstats *_gms); +int pmc_get_msr(pmc_id_t _pmc, uint32_t *_msr); +int pmc_init(void); +int pmc_read(pmc_id_t _pmc, pmc_value_t *_value); +int pmc_release(pmc_id_t _pmc); +int pmc_rw(pmc_id_t _pmc, pmc_value_t _newvalue, pmc_value_t *_oldvalue); +int pmc_set(pmc_id_t _pmc, pmc_value_t _value); +int pmc_start(pmc_id_t _pmc); +int pmc_stop(pmc_id_t _pmc); +int pmc_width(pmc_id_t _pmc, uint32_t *_width); +int pmc_write(pmc_id_t _pmc, pmc_value_t _value); +int pmc_writelog(uint32_t _udata); + +int pmc_ncpu(void); +int pmc_npmc(int _cpu); +int pmc_cpuinfo(const struct pmc_cpuinfo **_cpu_info); +int pmc_pmcinfo(int _cpu, struct pmc_pmcinfo **_pmc_info); + +const char *pmc_name_of_capability(uint32_t _c); +const char *pmc_name_of_class(enum pmc_class _pc); +const char *pmc_name_of_cputype(enum pmc_cputype _cp); +const char *pmc_name_of_disposition(enum pmc_disp _pd); +const char *pmc_name_of_event(enum pmc_event _pe); +const char *pmc_name_of_mode(enum pmc_mode _pm); +const char *pmc_name_of_state(enum pmc_state _ps); + +int pmc_event_names_of_class(enum pmc_class _cl, const char ***_eventnames, + int *_nevents); + +#endif diff --git a/src/include.new/pmclog.h b/src/include.new/pmclog.h new file mode 100644 index 0000000..81d2115 --- /dev/null +++ b/src/include.new/pmclog.h @@ -0,0 +1,149 @@ +/*- + * Copyright (c) 2005 Joseph Koshy + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD: src/lib/libpmc/pmclog.h,v 1.2 2005/06/30 19:01:26 jkoshy Exp $ + */ + +#ifndef _PMCLOG_H_ +#define _PMCLOG_H_ + +#include + +enum pmclog_state { + PMCLOG_OK, + PMCLOG_EOF, + PMCLOG_REQUIRE_DATA, + PMCLOG_ERROR +}; + +struct pmclog_ev_dropnotify { +}; + +struct pmclog_ev_closelog { +}; + +struct pmclog_ev_initialize { + uint32_t pl_version; + uint32_t pl_arch; +}; + +struct pmclog_ev_mappingchange { + uint32_t pl_type; + pid_t pl_pid; + uintfptr_t pl_start; + uintfptr_t pl_end; + char pl_pathname[PATH_MAX]; +}; + +struct pmclog_ev_pcsample { + uintfptr_t pl_pc; + pid_t pl_pid; + pmc_id_t pl_pmcid; + uint32_t pl_usermode; +}; + +struct pmclog_ev_pmcallocate { + uint32_t pl_event; + const char * pl_evname; + uint32_t pl_flags; + pmc_id_t pl_pmcid; +}; + +struct pmclog_ev_pmcattach { + pmc_id_t pl_pmcid; + pid_t pl_pid; + char pl_pathname[PATH_MAX]; +}; + +struct pmclog_ev_pmcdetach { + pmc_id_t pl_pmcid; + pid_t pl_pid; +}; + +struct pmclog_ev_proccsw { + pid_t pl_pid; + pmc_id_t pl_pmcid; + pmc_value_t pl_value; +}; + +struct pmclog_ev_procexec { + pid_t pl_pid; + pmc_id_t pl_pmcid; + uintfptr_t pl_entryaddr; + char pl_pathname[PATH_MAX]; +}; + +struct pmclog_ev_procexit { + uint32_t pl_pid; + pmc_id_t pl_pmcid; + pmc_value_t pl_value; +}; + +struct pmclog_ev_procfork { + pid_t pl_oldpid; + pid_t pl_newpid; +}; + +struct pmclog_ev_sysexit { + pid_t pl_pid; +}; + +struct pmclog_ev_userdata { + uint32_t pl_userdata; +}; + +struct pmclog_ev { + enum pmclog_state pl_state; /* state after 'get_event()' */ + off_t pl_offset; /* byte offset in stream */ + size_t pl_count; /* count of records so far */ + struct timespec pl_ts; /* log entry timestamp */ + enum pmclog_type pl_type; /* type of log entry */ + union { /* log entry data */ + struct pmclog_ev_closelog pl_cl; + struct pmclog_ev_dropnotify pl_dn; + struct pmclog_ev_initialize pl_i; + struct pmclog_ev_mappingchange pl_m; + struct pmclog_ev_pcsample pl_s; + struct pmclog_ev_pmcallocate pl_a; + struct pmclog_ev_pmcattach pl_t; + struct pmclog_ev_pmcdetach pl_d; + struct pmclog_ev_proccsw pl_c; + struct pmclog_ev_procexec pl_x; + struct pmclog_ev_procexit pl_e; + struct pmclog_ev_procfork pl_f; + struct pmclog_ev_sysexit pl_se; + struct pmclog_ev_userdata pl_u; + } pl_u; +}; + +#define PMCLOG_FD_NONE (-1) + +void *pmclog_open(int _fd); +int pmclog_feed(void *_cookie, char *_data, int _len); +int pmclog_read(void *_cookie, struct pmclog_ev *_ev); +void pmclog_close(void *_cookie); + +#endif + diff --git a/src/include.new/pmmintrin.h b/src/include.new/pmmintrin.h new file mode 100644 index 0000000..3b18e2a --- /dev/null +++ b/src/include.new/pmmintrin.h @@ -0,0 +1,132 @@ +/* Copyright (C) 2003 Free Software Foundation, Inc. + + This file is part of GCC. + + GCC is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + GCC is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with GCC; see the file COPYING. If not, write to + the Free Software Foundation, 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +/* As a special exception, if you include this header file into source + files compiled by GCC, this header file does not by itself cause + the resulting executable to be covered by the GNU General Public + License. This exception does not however invalidate any other + reasons why the executable file might be covered by the GNU General + Public License. */ + +/* Implemented from the specification included in the Intel C++ Compiler + User Guide and Reference, version 8.0. */ + +#ifndef _PMMINTRIN_H_INCLUDED +#define _PMMINTRIN_H_INCLUDED + +#ifdef __SSE3__ +#include +#include + +/* Additional bits in the MXCSR. */ +#define _MM_DENORMALS_ZERO_MASK 0x0040 +#define _MM_DENORMALS_ZERO_ON 0x0040 +#define _MM_DENORMALS_ZERO_OFF 0x0000 + +#define _MM_SET_DENORMALS_ZERO_MODE(mode) \ + _mm_setcsr ((_mm_getcsr () & ~_MM_DENORMALS_ZERO_MASK) | (mode)) +#define _MM_GET_DENORMALS_ZERO_MODE() \ + (_mm_getcsr() & _MM_DENORMALS_ZERO_MASK) + +static __inline __m128 +_mm_addsub_ps (__m128 __X, __m128 __Y) +{ + return (__m128) __builtin_ia32_addsubps ((__v4sf)__X, (__v4sf)__Y); +} + +static __inline __m128 +_mm_hadd_ps (__m128 __X, __m128 __Y) +{ + return (__m128) __builtin_ia32_haddps ((__v4sf)__X, (__v4sf)__Y); +} + +static __inline __m128 +_mm_hsub_ps (__m128 __X, __m128 __Y) +{ + return (__m128) __builtin_ia32_hsubps ((__v4sf)__X, (__v4sf)__Y); +} + +static __inline __m128 +_mm_movehdup_ps (__m128 __X) +{ + return (__m128) __builtin_ia32_movshdup ((__v4sf)__X); +} + +static __inline __m128 +_mm_moveldup_ps (__m128 __X) +{ + return (__m128) __builtin_ia32_movsldup ((__v4sf)__X); +} + +static __inline __m128d +_mm_addsub_pd (__m128d __X, __m128d __Y) +{ + return (__m128d) __builtin_ia32_addsubpd ((__v2df)__X, (__v2df)__Y); +} + +static __inline __m128d +_mm_hadd_pd (__m128d __X, __m128d __Y) +{ + return (__m128d) __builtin_ia32_haddpd ((__v2df)__X, (__v2df)__Y); +} + +static __inline __m128d +_mm_hsub_pd (__m128d __X, __m128d __Y) +{ + return (__m128d) __builtin_ia32_hsubpd ((__v2df)__X, (__v2df)__Y); +} + +static __inline __m128d +_mm_loaddup_pd (double const *__P) +{ + return (__m128d) __builtin_ia32_loadddup (__P); +} + +static __inline __m128d +_mm_movedup_pd (__m128d __X) +{ + return (__m128d) __builtin_ia32_movddup ((__v2df)__X); +} + +static __inline __m128i +_mm_lddqu_si128 (__m128i const *__P) +{ + return (__m128i) __builtin_ia32_lddqu ((char const *)__P); +} + +#if 0 +static __inline void +_mm_monitor (void const * __P, unsigned int __E, unsigned int __H) +{ + __builtin_ia32_monitor (__P, __E, __H); +} + +static __inline void +_mm_mwait (unsigned int __E, unsigned int __H) +{ + __builtin_ia32_mwait (__E, __H); +} +#else +#define _mm_monitor(P, E, H) __builtin_ia32_monitor ((P), (E), (H)) +#define _mm_mwait(E, H) __builtin_ia32_mwait ((E), (H)) +#endif + +#endif /* __SSE3__ */ + +#endif /* _PMMINTRIN_H_INCLUDED */ diff --git a/src/include.new/poll.h b/src/include.new/poll.h new file mode 100644 index 0000000..9ea42b9 --- /dev/null +++ b/src/include.new/poll.h @@ -0,0 +1,104 @@ +/*- + * Copyright (c) 1997 Peter Wemm + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD: src/sys/sys/poll.h,v 1.13 2002/07/10 04:47:25 mike Exp $ + */ + +#ifndef _SYS_POLL_H_ +#define _SYS_POLL_H_ + +#include + +/* + * This file is intended to be compatible with the traditional poll.h. + */ + +typedef unsigned int nfds_t; + +/* + * This structure is passed as an array to poll(2). + */ +struct pollfd { + int fd; /* which file descriptor to poll */ + short events; /* events we are interested in */ + short revents; /* events found on return */ +}; + +/* + * Requestable events. If poll(2) finds any of these set, they are + * copied to revents on return. + * XXX Note that FreeBSD doesn't make much distinction between POLLPRI + * and POLLRDBAND since none of the file types have distinct priority + * bands - and only some have an urgent "mode". + * XXX Note POLLIN isn't really supported in true SVSV terms. Under SYSV + * POLLIN includes all of normal, band and urgent data. Most poll handlers + * on FreeBSD only treat it as "normal" data. + */ +#define POLLIN 0x0001 /* any readable data available */ +#define POLLPRI 0x0002 /* OOB/Urgent readable data */ +#define POLLOUT 0x0004 /* file descriptor is writeable */ +#define POLLRDNORM 0x0040 /* non-OOB/URG data available */ +#define POLLWRNORM POLLOUT /* no write type differentiation */ +#define POLLRDBAND 0x0080 /* OOB/Urgent readable data */ +#define POLLWRBAND 0x0100 /* OOB/Urgent data can be written */ + +#if __BSD_VISIBLE +/* General FreeBSD extension (currently only supported for sockets): */ +#define POLLINIGNEOF 0x2000 /* like POLLIN, except ignore EOF */ +#endif + +/* + * These events are set if they occur regardless of whether they were + * requested. + */ +#define POLLERR 0x0008 /* some poll error occurred */ +#define POLLHUP 0x0010 /* file descriptor was "hung up" */ +#define POLLNVAL 0x0020 /* requested events "invalid" */ + +#if __BSD_VISIBLE + +#define POLLSTANDARD (POLLIN|POLLPRI|POLLOUT|POLLRDNORM|POLLRDBAND|\ + POLLWRBAND|POLLERR|POLLHUP|POLLNVAL) + +/* + * Request that poll() wait forever. + * XXX in SYSV, this is defined in stropts.h, which is not included + * by poll.h. + */ +#define INFTIM (-1) + +#endif + +#ifndef _KERNEL + +__BEGIN_DECLS +int poll(struct pollfd _pfd[], nfds_t _nfds, int _timeout); +__END_DECLS + +#endif /* !_KERNEL */ + +#endif /* !_SYS_POLL_H_ */ diff --git a/src/include.new/printf.h b/src/include.new/printf.h new file mode 100644 index 0000000..9e38283 --- /dev/null +++ b/src/include.new/printf.h @@ -0,0 +1,163 @@ +/*- + * Copyright (c) 2005 Poul-Henning Kamp + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD: src/include/printf.h,v 1.4.2.1 2006/06/25 07:35:50 phk Exp $ + */ + +#ifndef _PRINTF_H_ +#define _PRINTF_H_ + +#include + +/* + * The API defined by glibc allows a renderer to take multiple arguments + * This is obviously usable for things like (ptr+len) pairs etc. + * But the do not actually provide support for it at the end of the day, + * they offer only one argument to the arginfo function, but do accept + * >1 returns, although the do not check the types of those arguments + * argument + * Be compatible for now. + */ +#define __PRINTFMAXARG 2 + +struct printf_info { + /* GLIBC compatible */ + int prec; + int width; + wchar_t spec; + unsigned is_long_double; + unsigned is_char; + unsigned is_short; + unsigned is_long; + unsigned alt; + unsigned space; + unsigned left; + unsigned showsign; + unsigned group; + unsigned extra; + unsigned wide; + wchar_t pad; + + /* FreeBSD extensions */ + + unsigned is_quad; + unsigned is_intmax; + unsigned is_ptrdiff; + unsigned is_size; + + /* private */ + int sofar; + unsigned get_width; + unsigned get_prec; + const char *begin; + const char *end; + void *arg[__PRINTFMAXARG]; +}; + +enum { + PA_INT = (1 << 0), /* int */ + PA_CHAR = (1 << 1), /* int, cast to char */ + PA_WCHAR = (1 << 2), /* wide char */ + PA_STRING = (1 << 3), /* const char * (with '\0') */ + PA_WSTRING = (1 << 4), /* const wchar_t * */ + PA_POINTER = (1 << 5), /* void * */ + PA_FLOAT = (1 << 6), /* float */ + PA_DOUBLE = (1 << 7) /* double */ +}; + +#define PA_FLAG_MASK 0xff0000 +#define PA_FLAG_LONG_LONG (1 << 16) +#define PA_FLAG_LONG (1 << 17) +#define PA_FLAG_SHORT (1 << 18) +#define PA_FLAG_PTR (1 << 19) +#define PA_FLAG_QUAD (1 << 20) +#define PA_FLAG_INTMAX (1 << 21) +#define PA_FLAG_SIZE (1 << 22) +#define PA_FLAG_PTRDIFF (1 << 23) +#define PA_FLAG_LONG_DOUBLE PA_FLAG_LONG_LONG + +typedef int printf_arginfo_function(const struct printf_info *, size_t, int *); +typedef int printf_function(FILE *, const struct printf_info *, const void *const *); + +/* FreeBSD extension */ +struct __printf_io; +typedef int printf_render(struct __printf_io *, const struct printf_info *, const void *const *); + +/* vprintf.c */ +extern const char __lowercase_hex[17]; +extern const char __uppercase_hex[17]; + +void __printf_flush(struct __printf_io *io); +int __printf_puts(struct __printf_io *io, const void *ptr, int len); +int __printf_pad(struct __printf_io *io, int n, int zero); +int __printf_out(struct __printf_io *io, const struct printf_info *pi, const void *ptr, int len); + +int __xvprintf(FILE *fp, const char *fmt0, va_list ap); +extern int __use_xprintf; + +/* GLIBC compat */ +int register_printf_function(int spec, printf_function *render, printf_arginfo_function *arginfo); + +/* FreeBSD */ +int register_printf_render(int spec, printf_render *render, printf_arginfo_function *arginfo); +int register_printf_render_std(const unsigned char *specs); + +/* vprintf_errno.c */ +printf_arginfo_function __printf_arginfo_errno; +printf_render __printf_render_errno; + +/* vprintf_float.c */ +printf_arginfo_function __printf_arginfo_float; +printf_render __printf_render_float; + +/* vprintf_hexdump.c */ +printf_arginfo_function __printf_arginfo_hexdump; +printf_render __printf_render_hexdump; + +/* vprintf_int.c */ +printf_arginfo_function __printf_arginfo_ptr; +printf_arginfo_function __printf_arginfo_int; +printf_render __printf_render_ptr; +printf_render __printf_render_int; + +/* vprintf_quoute.c */ +printf_arginfo_function __printf_arginfo_quote; +printf_render __printf_render_quote; + +/* vprintf_str.c */ +printf_arginfo_function __printf_arginfo_chr; +printf_render __printf_render_chr; +printf_arginfo_function __printf_arginfo_str; +printf_render __printf_render_str; + +/* vprintf_time.c */ +printf_arginfo_function __printf_arginfo_time; +printf_render __printf_render_time; + +/* vprintf_vis.c */ +printf_arginfo_function __printf_arginfo_vis; +printf_render __printf_render_vis; + +#endif /* !_PRINTF_H */ diff --git a/src/include.new/proc_service.h b/src/include.new/proc_service.h new file mode 100644 index 0000000..43cb8a1 --- /dev/null +++ b/src/include.new/proc_service.h @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2004 David Xu + * Copyright (c) 2004 Marcel Moolenaar + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD: src/include/proc_service.h,v 1.3.2.1 2006/05/17 02:28:14 davidxu Exp $ + */ + +#ifndef _PROC_SERVICE_H_ +#define _PROC_SERVICE_H_ + +#include +#include + +typedef enum { + PS_OK = 0, /* No errors. */ + PS_ERR, /* Generic error. */ + PS_BADADDR, /* Bad address. */ + PS_BADLID, /* Bad LWP Id. */ + PS_BADPID, /* Bad process Id. */ + PS_NOFREGS, /* FPU register set not available. */ + PS_NOSYM /* Symbol not found. */ +} ps_err_e; + +struct ps_prochandle; /* Opaque type. Defined by the implementor. */ + +__BEGIN_DECLS +ps_err_e ps_lcontinue(struct ps_prochandle *, lwpid_t); +ps_err_e ps_lgetfpregs(struct ps_prochandle *, lwpid_t, prfpregset_t *); +ps_err_e ps_lgetregs(struct ps_prochandle *, lwpid_t, prgregset_t); +ps_err_e ps_lsetfpregs(struct ps_prochandle *, lwpid_t, const prfpregset_t *); +ps_err_e ps_lsetregs(struct ps_prochandle *, lwpid_t, const prgregset_t); +#ifdef __i386__ +ps_err_e ps_lgetxmmregs (struct ps_prochandle *, lwpid_t, char *); +ps_err_e ps_lsetxmmregs (struct ps_prochandle *, lwpid_t, const char *); +#endif +ps_err_e ps_lstop(struct ps_prochandle *, lwpid_t); +ps_err_e ps_linfo(struct ps_prochandle *, lwpid_t, void *); +ps_err_e ps_pcontinue(struct ps_prochandle *); +ps_err_e ps_pdmodel(struct ps_prochandle *, int *); +ps_err_e ps_pglobal_lookup(struct ps_prochandle *, const char *, const char *, + psaddr_t *); +void ps_plog(const char *, ...); +ps_err_e ps_pread(struct ps_prochandle *, psaddr_t, void *, size_t); +ps_err_e ps_pstop(struct ps_prochandle *); +ps_err_e ps_pwrite(struct ps_prochandle *, psaddr_t, const void *, size_t); +__END_DECLS + +#endif /* _PROC_SERVICE_H_ */ diff --git a/src/include.new/pthread.h b/src/include.new/pthread.h new file mode 100644 index 0000000..3c32f32 --- /dev/null +++ b/src/include.new/pthread.h @@ -0,0 +1,277 @@ +/* + * Copyright (c) 1993, 1994 by Chris Provenzano, proven@mit.edu + * Copyright (c) 1995-1998 by John Birrell + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Chris Provenzano. + * 4. The name of Chris Provenzano may not be used to endorse or promote + * products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY CHRIS PROVENZANO ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL CHRIS PROVENZANO BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD: src/include/pthread.h,v 1.36.2.1 2005/12/15 06:50:39 davidxu Exp $ + */ +#ifndef _PTHREAD_H_ +#define _PTHREAD_H_ + +/* + * Header files. + */ +#include +#include +#include +#include +#include +#include +#include + +/* + * Run-time invariant values: + */ +#define PTHREAD_DESTRUCTOR_ITERATIONS 4 +#define PTHREAD_KEYS_MAX 256 +#define PTHREAD_STACK_MIN MINSIGSTKSZ +#define PTHREAD_THREADS_MAX ULONG_MAX +#define PTHREAD_BARRIER_SERIAL_THREAD -1 + +/* + * Flags for threads and thread attributes. + */ +#define PTHREAD_DETACHED 0x1 +#define PTHREAD_SCOPE_SYSTEM 0x2 +#define PTHREAD_INHERIT_SCHED 0x4 +#define PTHREAD_NOFLOAT 0x8 + +#define PTHREAD_CREATE_DETACHED PTHREAD_DETACHED +#define PTHREAD_CREATE_JOINABLE 0 +#define PTHREAD_SCOPE_PROCESS 0 +#define PTHREAD_EXPLICIT_SCHED 0 + +/* + * Flags for read/write lock attributes + */ +#define PTHREAD_PROCESS_PRIVATE 0 +#define PTHREAD_PROCESS_SHARED 1 + +/* + * Flags for cancelling threads + */ +#define PTHREAD_CANCEL_ENABLE 0 +#define PTHREAD_CANCEL_DISABLE 1 +#define PTHREAD_CANCEL_DEFERRED 0 +#define PTHREAD_CANCEL_ASYNCHRONOUS 2 +#define PTHREAD_CANCELED ((void *) 1) + +/* + * Flags for once initialization. + */ +#define PTHREAD_NEEDS_INIT 0 +#define PTHREAD_DONE_INIT 1 + +/* + * Static once initialization values. + */ +#define PTHREAD_ONCE_INIT { PTHREAD_NEEDS_INIT, NULL } + +/* + * Static initialization values. + */ +#define PTHREAD_MUTEX_INITIALIZER NULL +#define PTHREAD_COND_INITIALIZER NULL +#define PTHREAD_RWLOCK_INITIALIZER NULL + +/* + * Default attribute arguments (draft 4, deprecated). + */ +#ifndef PTHREAD_KERNEL +#define pthread_condattr_default NULL +#define pthread_mutexattr_default NULL +#define pthread_attr_default NULL +#endif + +#define PTHREAD_PRIO_NONE 0 +#define PTHREAD_PRIO_INHERIT 1 +#define PTHREAD_PRIO_PROTECT 2 + +/* + * Mutex types (Single UNIX Specification, Version 2, 1997). + * + * Note that a mutex attribute with one of the following types: + * + * PTHREAD_MUTEX_NORMAL + * PTHREAD_MUTEX_RECURSIVE + * MUTEX_TYPE_FAST (deprecated) + * MUTEX_TYPE_COUNTING_FAST (deprecated) + * + * will deviate from POSIX specified semantics. + */ +enum pthread_mutextype { + PTHREAD_MUTEX_ERRORCHECK = 1, /* Default POSIX mutex */ + PTHREAD_MUTEX_RECURSIVE = 2, /* Recursive mutex */ + PTHREAD_MUTEX_NORMAL = 3, /* No error checking */ + MUTEX_TYPE_MAX +}; + +#define PTHREAD_MUTEX_DEFAULT PTHREAD_MUTEX_ERRORCHECK +#define MUTEX_TYPE_FAST PTHREAD_MUTEX_NORMAL +#define MUTEX_TYPE_COUNTING_FAST PTHREAD_MUTEX_RECURSIVE + +/* + * Thread function prototype definitions: + */ +__BEGIN_DECLS +int pthread_atfork(void (*prepare)(void), void (*parent)(void), + void (*child)(void)); +int pthread_attr_destroy(pthread_attr_t *); +int pthread_attr_getstack(const pthread_attr_t * __restrict, + void ** __restrict stackaddr, + size_t * __restrict stacksize); +int pthread_attr_getstacksize(const pthread_attr_t *, size_t *); +int pthread_attr_getguardsize(const pthread_attr_t *, size_t *); +int pthread_attr_getstackaddr(const pthread_attr_t *, void **); +int pthread_attr_getdetachstate(const pthread_attr_t *, int *); +int pthread_attr_init(pthread_attr_t *); +int pthread_attr_setstacksize(pthread_attr_t *, size_t); +int pthread_attr_setguardsize(pthread_attr_t *, size_t); +int pthread_attr_setstack(pthread_attr_t *, void *, size_t); +int pthread_attr_setstackaddr(pthread_attr_t *, void *); +int pthread_attr_setdetachstate(pthread_attr_t *, int); +int pthread_barrier_destroy(pthread_barrier_t *); +int pthread_barrier_init(pthread_barrier_t *, + const pthread_barrierattr_t *, unsigned); +int pthread_barrier_wait(pthread_barrier_t *); +int pthread_barrierattr_destroy(pthread_barrierattr_t *); +int pthread_barrierattr_getpshared(const pthread_barrierattr_t *, + int *); +int pthread_barrierattr_init(pthread_barrierattr_t *); +int pthread_barrierattr_setpshared(pthread_barrierattr_t *, int); +void pthread_cleanup_pop(int); +void pthread_cleanup_push(void (*) (void *), void *routine_arg); +int pthread_condattr_destroy(pthread_condattr_t *); +int pthread_condattr_init(pthread_condattr_t *); +int pthread_condattr_getpshared(const pthread_condattr_t *, int *); +int pthread_condattr_getclock(const pthread_condattr_t *, + clockid_t *); +int pthread_condattr_setclock(pthread_condattr_t *, + clockid_t); +int pthread_condattr_setpshared(pthread_condattr_t *, int); +int pthread_cond_broadcast(pthread_cond_t *); +int pthread_cond_destroy(pthread_cond_t *); +int pthread_cond_init(pthread_cond_t *, + const pthread_condattr_t *); +int pthread_cond_signal(pthread_cond_t *); +int pthread_cond_timedwait(pthread_cond_t *, + pthread_mutex_t *, const struct timespec *); +int pthread_cond_wait(pthread_cond_t *, pthread_mutex_t *); +int pthread_create(pthread_t *, const pthread_attr_t *, + void *(*) (void *), void *); +int pthread_detach(pthread_t); +int pthread_equal(pthread_t, pthread_t); +void pthread_exit(void *) __dead2; +void *pthread_getspecific(pthread_key_t); +int pthread_join(pthread_t, void **); +int pthread_key_create(pthread_key_t *, + void (*) (void *)); +int pthread_key_delete(pthread_key_t); +int pthread_kill(pthread_t, int); +int pthread_mutexattr_init(pthread_mutexattr_t *); +int pthread_mutexattr_destroy(pthread_mutexattr_t *); +int pthread_mutexattr_gettype(pthread_mutexattr_t *, int *); +int pthread_mutexattr_getpshared(const pthread_mutexattr_t *, + int *); +int pthread_mutexattr_settype(pthread_mutexattr_t *, int); +int pthread_mutexattr_setpshared(pthread_mutexattr_t *, int); +int pthread_mutex_destroy(pthread_mutex_t *); +int pthread_mutex_init(pthread_mutex_t *, + const pthread_mutexattr_t *); +int pthread_mutex_lock(pthread_mutex_t *); +int pthread_mutex_trylock(pthread_mutex_t *); +int pthread_mutex_timedlock(pthread_mutex_t *, + const struct timespec *); +int pthread_mutex_unlock(pthread_mutex_t *); +int pthread_once(pthread_once_t *, void (*) (void)); +int pthread_rwlock_destroy(pthread_rwlock_t *); +int pthread_rwlock_init(pthread_rwlock_t *, + const pthread_rwlockattr_t *); +int pthread_rwlock_rdlock(pthread_rwlock_t *); +int pthread_rwlock_timedrdlock(pthread_rwlock_t *, + const struct timespec *); +int pthread_rwlock_timedwrlock(pthread_rwlock_t *, + const struct timespec *); +int pthread_rwlock_tryrdlock(pthread_rwlock_t *); +int pthread_rwlock_trywrlock(pthread_rwlock_t *); +int pthread_rwlock_unlock(pthread_rwlock_t *); +int pthread_rwlock_wrlock(pthread_rwlock_t *); +int pthread_rwlockattr_init(pthread_rwlockattr_t *); +int pthread_rwlockattr_getpshared(const pthread_rwlockattr_t *, + int *); +int pthread_rwlockattr_setpshared(pthread_rwlockattr_t *, int); +int pthread_rwlockattr_destroy(pthread_rwlockattr_t *); +pthread_t pthread_self(void); +int pthread_setspecific(pthread_key_t, const void *); +int pthread_sigmask(int, const sigset_t *, sigset_t *); + +int pthread_spin_init(pthread_spinlock_t *, int); +int pthread_spin_destroy(pthread_spinlock_t *); +int pthread_spin_lock(pthread_spinlock_t *); +int pthread_spin_trylock(pthread_spinlock_t *); +int pthread_spin_unlock(pthread_spinlock_t *); +int pthread_cancel(pthread_t); +int pthread_setcancelstate(int, int *); +int pthread_setcanceltype(int, int *); +void pthread_testcancel(void); + +int pthread_getprio(pthread_t); +int pthread_setprio(pthread_t, int); +void pthread_yield(void); + +int pthread_mutexattr_getprioceiling(pthread_mutexattr_t *, + int *); +int pthread_mutexattr_setprioceiling(pthread_mutexattr_t *, + int); +int pthread_mutex_getprioceiling(pthread_mutex_t *, int *); +int pthread_mutex_setprioceiling(pthread_mutex_t *, int, int *); + +int pthread_mutexattr_getprotocol(pthread_mutexattr_t *, int *); +int pthread_mutexattr_setprotocol(pthread_mutexattr_t *, int); + +int pthread_attr_getinheritsched(const pthread_attr_t *, int *); +int pthread_attr_getschedparam(const pthread_attr_t *, + struct sched_param *); +int pthread_attr_getschedpolicy(const pthread_attr_t *, int *); +int pthread_attr_getscope(const pthread_attr_t *, int *); +int pthread_attr_setinheritsched(pthread_attr_t *, int); +int pthread_attr_setschedparam(pthread_attr_t *, + const struct sched_param *); +int pthread_attr_setschedpolicy(pthread_attr_t *, int); +int pthread_attr_setscope(pthread_attr_t *, int); +int pthread_getschedparam(pthread_t pthread, int *, + struct sched_param *); +int pthread_setschedparam(pthread_t, int, + const struct sched_param *); +int pthread_getconcurrency(void); +int pthread_setconcurrency(int); +__END_DECLS + +#endif diff --git a/src/include.new/pthread_np.h b/src/include.new/pthread_np.h new file mode 100644 index 0000000..3c2a82c --- /dev/null +++ b/src/include.new/pthread_np.h @@ -0,0 +1,62 @@ +/* + * Copyright (c) 1996-98 John Birrell . + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by John Birrell. + * 4. Neither the name of the author nor the names of any co-contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD: src/include/pthread_np.h,v 1.15 2003/01/07 21:43:30 fjoe Exp $ + */ +#ifndef _PTHREAD_NP_H_ +#define _PTHREAD_NP_H_ + +/* + * Non-POSIX type definitions: + */ +typedef void (*pthread_switch_routine_t)(pthread_t, pthread_t); + +/* + * Non-POSIX thread function prototype definitions: + */ +__BEGIN_DECLS +int pthread_attr_setcreatesuspend_np(pthread_attr_t *); +int pthread_attr_get_np(pthread_t, pthread_attr_t *); +int pthread_main_np(void); +int pthread_multi_np(void); +int pthread_mutexattr_getkind_np(pthread_mutexattr_t); +int pthread_mutexattr_setkind_np(pthread_mutexattr_t *, int); +void pthread_resume_all_np(void); +int pthread_resume_np(pthread_t); +void pthread_set_name_np(pthread_t, const char *); +int pthread_single_np(void); +void pthread_suspend_all_np(void); +int pthread_suspend_np(pthread_t); +int pthread_switch_add_np(pthread_switch_routine_t); +int pthread_switch_delete_np(pthread_switch_routine_t); +__END_DECLS + +#endif diff --git a/src/include.new/pwd.h b/src/include.new/pwd.h new file mode 100644 index 0000000..69a1a89 --- /dev/null +++ b/src/include.new/pwd.h @@ -0,0 +1,172 @@ +/*- + * Copyright (c) 1989, 1993 + * The Regents of the University of California. All rights reserved. + * (c) UNIX System Laboratories, Inc. + * All or some portions of this file are derived from material licensed + * to the University of California by American Telephone and Telegraph + * Co. or Unix System Laboratories, Inc. and are reproduced herein with + * the permission of UNIX System Laboratories, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)pwd.h 8.2 (Berkeley) 1/21/94 + * $FreeBSD: src/include/pwd.h,v 1.16 2005/01/26 17:26:54 nectar Exp $ + */ + +#ifndef _PWD_H_ +#define _PWD_H_ + +#include +#include + +#ifndef _GID_T_DECLARED +typedef __gid_t gid_t; +#define _GID_T_DECLARED +#endif + +#ifndef _TIME_T_DECLARED +typedef __time_t time_t; +#define _TIME_T_DECLARED +#endif + +#ifndef _UID_T_DECLARED +typedef __uid_t uid_t; +#define _UID_T_DECLARED +#endif + +#ifndef _SIZE_T_DECLARED +typedef __size_t size_t; +#define _SIZE_T_DECLARED +#endif + +#define _PATH_PWD "/etc" +#define _PATH_PASSWD "/etc/passwd" +#define _PASSWD "passwd" +#define _PATH_MASTERPASSWD "/etc/master.passwd" +#define _MASTERPASSWD "master.passwd" + +#define _PATH_MP_DB "/etc/pwd.db" +#define _MP_DB "pwd.db" +#define _PATH_SMP_DB "/etc/spwd.db" +#define _SMP_DB "spwd.db" + +#define _PATH_PWD_MKDB "/usr/sbin/pwd_mkdb" + +/* Historically, the keys in _PATH_MP_DB/_PATH_SMP_DB had the format + * `1 octet tag | key', where the tag is one of the _PW_KEY* values + * listed below. These values happen to be ASCII digits. Starting + * with FreeBSD 5.1, the tag is now still a single octet, but the + * upper 4 bits are interpreted as a version. Pre-FreeBSD 5.1 format + * entries are version `3' -- this conveniently results in the same + * key values as before. The new, architecture-independent entries + * are version `4'. + * As it happens, some applications read the database directly. + * (Bad app, no cookie!) Thus, we leave the _PW_KEY* symbols at their + * old pre-FreeBSD 5.1 values so these apps still work. Consequently + * we have to muck around a bit more to get the correct, versioned + * tag, and that is what the _PW_VERSIONED macro is about. + */ + +#define _PW_VERSION_MASK '\xF0' +#define _PW_VERSIONED(x, v) ((unsigned char)(((x) & 0xCF) | ((v)<<4))) + +#define _PW_KEYBYNAME '\x31' /* stored by name */ +#define _PW_KEYBYNUM '\x32' /* stored by entry in the "file" */ +#define _PW_KEYBYUID '\x33' /* stored by uid */ +#define _PW_KEYYPENABLED '\x34' /* YP is enabled */ +#define _PW_KEYYPBYNUM '\x35' /* special +@netgroup entries */ + +/* The database also contains a key to indicate the format version of + * the entries therein. There may be other, older versioned entries + * as well. + */ +#define _PWD_VERSION_KEY "\xFF" "VERSION" +#define _PWD_CURRENT_VERSION '\x04' + +#define _PASSWORD_EFMT1 '_' /* extended encryption format */ + +#define _PASSWORD_LEN 128 /* max length, not counting NULL */ + +struct passwd { + char *pw_name; /* user name */ + char *pw_passwd; /* encrypted password */ + uid_t pw_uid; /* user uid */ + gid_t pw_gid; /* user gid */ + time_t pw_change; /* password change time */ + char *pw_class; /* user access class */ + char *pw_gecos; /* Honeywell login info */ + char *pw_dir; /* home directory */ + char *pw_shell; /* default shell */ + time_t pw_expire; /* account expiration */ + int pw_fields; /* internal: fields filled in */ +}; + +/* Mapping from fields to bits for pw_fields. */ +#define _PWF(x) (1 << x) +#define _PWF_NAME _PWF(0) +#define _PWF_PASSWD _PWF(1) +#define _PWF_UID _PWF(2) +#define _PWF_GID _PWF(3) +#define _PWF_CHANGE _PWF(4) +#define _PWF_CLASS _PWF(5) +#define _PWF_GECOS _PWF(6) +#define _PWF_DIR _PWF(7) +#define _PWF_SHELL _PWF(8) +#define _PWF_EXPIRE _PWF(9) + +/* XXX These flags are bogus. With nsswitch, there are many + * possible sources and they cannot be represented in a small integer. + */ +#define _PWF_SOURCE 0x3000 +#define _PWF_FILES 0x1000 +#define _PWF_NIS 0x2000 +#define _PWF_HESIOD 0x3000 + +__BEGIN_DECLS +struct passwd *getpwnam(const char *); +struct passwd *getpwuid(uid_t); + +#if __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE >= 500 +void endpwent(void); +struct passwd *getpwent(void); +void setpwent(void); +int getpwnam_r(const char *, struct passwd *, char *, size_t, + struct passwd **); +int getpwuid_r(uid_t, struct passwd *, char *, size_t, + struct passwd **); +#endif + +#if __BSD_VISIBLE +int getpwent_r(struct passwd *, char *, size_t, struct passwd **); +int setpassent(int); +const char *user_from_uid(uid_t, int); +#endif +__END_DECLS + +#endif /* !_PWD_H_ */ diff --git a/src/include.new/radlib.h b/src/include.new/radlib.h new file mode 100644 index 0000000..e6cacc2 --- /dev/null +++ b/src/include.new/radlib.h @@ -0,0 +1,220 @@ +/*- + * Copyright 1998 Juniper Networks, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD: src/lib/libradius/radlib.h,v 1.7 2004/04/27 15:00:29 ru Exp $ + */ + +#ifndef _RADLIB_H_ +#define _RADLIB_H_ + +#include +#include + +/* Limits */ +#define RAD_MAX_ATTR_LEN 253 + +/* Message types */ +#define RAD_ACCESS_REQUEST 1 +#define RAD_ACCESS_ACCEPT 2 +#define RAD_ACCESS_REJECT 3 +#define RAD_ACCOUNTING_REQUEST 4 +#define RAD_ACCOUNTING_RESPONSE 5 +#define RAD_ACCESS_CHALLENGE 11 + +/* Attribute types and values */ +#define RAD_USER_NAME 1 /* String */ +#define RAD_USER_PASSWORD 2 /* String */ +#define RAD_CHAP_PASSWORD 3 /* String */ +#define RAD_NAS_IP_ADDRESS 4 /* IP address */ +#define RAD_NAS_PORT 5 /* Integer */ +#define RAD_SERVICE_TYPE 6 /* Integer */ + #define RAD_LOGIN 1 + #define RAD_FRAMED 2 + #define RAD_CALLBACK_LOGIN 3 + #define RAD_CALLBACK_FRAMED 4 + #define RAD_OUTBOUND 5 + #define RAD_ADMINISTRATIVE 6 + #define RAD_NAS_PROMPT 7 + #define RAD_AUTHENTICATE_ONLY 8 + #define RAD_CALLBACK_NAS_PROMPT 9 +#define RAD_FRAMED_PROTOCOL 7 /* Integer */ + #define RAD_PPP 1 + #define RAD_SLIP 2 + #define RAD_ARAP 3 /* Appletalk */ + #define RAD_GANDALF 4 + #define RAD_XYLOGICS 5 +#define RAD_FRAMED_IP_ADDRESS 8 /* IP address */ +#define RAD_FRAMED_IP_NETMASK 9 /* IP address */ +#define RAD_FRAMED_ROUTING 10 /* Integer */ +#define RAD_FILTER_ID 11 /* String */ +#define RAD_FRAMED_MTU 12 /* Integer */ +#define RAD_FRAMED_COMPRESSION 13 /* Integer */ + #define RAD_COMP_NONE 0 + #define RAD_COMP_VJ 1 + #define RAD_COMP_IPXHDR 2 +#define RAD_LOGIN_IP_HOST 14 /* IP address */ +#define RAD_LOGIN_SERVICE 15 /* Integer */ +#define RAD_LOGIN_TCP_PORT 16 /* Integer */ + /* unassiged 17 */ +#define RAD_REPLY_MESSAGE 18 /* String */ +#define RAD_CALLBACK_NUMBER 19 /* String */ +#define RAD_CALLBACK_ID 20 /* String */ + /* unassiged 21 */ +#define RAD_FRAMED_ROUTE 22 /* String */ +#define RAD_FRAMED_IPX_NETWORK 23 /* IP address */ +#define RAD_STATE 24 /* String */ +#define RAD_CLASS 25 /* Integer */ +#define RAD_VENDOR_SPECIFIC 26 /* Integer */ +#define RAD_SESSION_TIMEOUT 27 /* Integer */ +#define RAD_IDLE_TIMEOUT 28 /* Integer */ +#define RAD_TERMINATION_ACTION 29 /* Integer */ +#define RAD_CALLED_STATION_ID 30 /* String */ +#define RAD_CALLING_STATION_ID 31 /* String */ +#define RAD_NAS_IDENTIFIER 32 /* Integer */ +#define RAD_PROXY_STATE 33 /* Integer */ +#define RAD_LOGIN_LAT_SERVICE 34 /* Integer */ +#define RAD_LOGIN_LAT_NODE 35 /* Integer */ +#define RAD_LOGIN_LAT_GROUP 36 /* Integer */ +#define RAD_FRAMED_APPLETALK_LINK 37 /* Integer */ +#define RAD_FRAMED_APPLETALK_NETWORK 38 /* Integer */ +#define RAD_FRAMED_APPLETALK_ZONE 39 /* Integer */ + /* reserved for accounting 40-59 */ +#define RAD_ACCT_INPUT_GIGAWORDS 52 +#define RAD_ACCT_OUTPUT_GIGAWORDS 53 + +#define RAD_CHAP_CHALLENGE 60 /* String */ +#define RAD_NAS_PORT_TYPE 61 /* Integer */ + #define RAD_ASYNC 0 + #define RAD_SYNC 1 + #define RAD_ISDN_SYNC 2 + #define RAD_ISDN_ASYNC_V120 3 + #define RAD_ISDN_ASYNC_V110 4 + #define RAD_VIRTUAL 5 + #define RAD_PIAFS 6 + #define RAD_HDLC_CLEAR_CHANNEL 7 + #define RAD_X_25 8 + #define RAD_X_75 9 + #define RAD_G_3_FAX 10 + #define RAD_SDSL 11 + #define RAD_ADSL_CAP 12 + #define RAD_ADSL_DMT 13 + #define RAD_IDSL 14 + #define RAD_ETHERNET 15 + #define RAD_XDSL 16 + #define RAD_CABLE 17 + #define RAD_WIRELESS_OTHER 18 + #define RAD_WIRELESS_IEEE_802_11 19 +#define RAD_PORT_LIMIT 62 /* Integer */ +#define RAD_LOGIN_LAT_PORT 63 /* Integer */ +#define RAD_CONNECT_INFO 77 /* String */ +#define RAD_EAP_MESSAGE 79 /* Octets */ +#define RAD_MESSAGE_AUTHENTIC 80 /* Octets */ +#define RAD_ACCT_INTERIM_INTERVAL 85 /* Integer */ +#define RAD_NAS_IPV6_ADDRESS 95 /* IPv6 address */ +#define RAD_FRAMED_INTERFACE_ID 96 /* 8 octets */ +#define RAD_FRAMED_IPV6_PREFIX 97 /* Octets */ +#define RAD_LOGIN_IPV6_HOST 98 /* IPv6 address */ +#define RAD_FRAMED_IPV6_ROUTE 99 /* String */ +#define RAD_FRAMED_IPV6_POOL 100 /* String */ + +/* Accounting attribute types and values */ +#define RAD_ACCT_STATUS_TYPE 40 /* Integer */ + #define RAD_START 1 + #define RAD_STOP 2 + #define RAD_UPDATE 3 + #define RAD_ACCOUNTING_ON 7 + #define RAD_ACCOUNTING_OFF 8 +#define RAD_ACCT_DELAY_TIME 41 /* Integer */ +#define RAD_ACCT_INPUT_OCTETS 42 /* Integer */ +#define RAD_ACCT_OUTPUT_OCTETS 43 /* Integer */ +#define RAD_ACCT_SESSION_ID 44 /* String */ +#define RAD_ACCT_AUTHENTIC 45 /* Integer */ + #define RAD_AUTH_RADIUS 1 + #define RAD_AUTH_LOCAL 2 + #define RAD_AUTH_REMOTE 3 +#define RAD_ACCT_SESSION_TIME 46 /* Integer */ +#define RAD_ACCT_INPUT_PACKETS 47 /* Integer */ +#define RAD_ACCT_OUTPUT_PACKETS 48 /* Integer */ +#define RAD_ACCT_TERMINATE_CAUSE 49 /* Integer */ + #define RAD_TERM_USER_REQUEST 1 + #define RAD_TERM_LOST_CARRIER 2 + #define RAD_TERM_LOST_SERVICE 3 + #define RAD_TERM_IDLE_TIMEOUT 4 + #define RAD_TERM_SESSION_TIMEOUT 5 + #define RAD_TERM_ADMIN_RESET 6 + #define RAD_TERM_ADMIN_REBOOT 7 + #define RAD_TERM_PORT_ERROR 8 + #define RAD_TERM_NAS_ERROR 9 + #define RAD_TERM_NAS_REQUEST 10 + #define RAD_TERM_NAS_REBOOT 11 + #define RAD_TERM_PORT_UNNEEDED 12 + #define RAD_TERM_PORT_PREEMPTED 13 + #define RAD_TERM_PORT_SUSPENDED 14 + #define RAD_TERM_SERVICE_UNAVAILABLE 15 + #define RAD_TERM_CALLBACK 16 + #define RAD_TERM_USER_ERROR 17 + #define RAD_TERM_HOST_REQUEST 18 +#define RAD_ACCT_MULTI_SESSION_ID 50 /* String */ +#define RAD_ACCT_LINK_COUNT 51 /* Integer */ + +struct rad_handle; +struct timeval; + +__BEGIN_DECLS +struct rad_handle *rad_acct_open(void); +int rad_add_server(struct rad_handle *, + const char *, int, const char *, int, int); +struct rad_handle *rad_auth_open(void); +void rad_close(struct rad_handle *); +int rad_config(struct rad_handle *, const char *); +int rad_continue_send_request(struct rad_handle *, int, + int *, struct timeval *); +int rad_create_request(struct rad_handle *, int); +struct in_addr rad_cvt_addr(const void *); +u_int32_t rad_cvt_int(const void *); +char *rad_cvt_string(const void *, size_t); +int rad_get_attr(struct rad_handle *, const void **, + size_t *); +int rad_init_send_request(struct rad_handle *, int *, + struct timeval *); +struct rad_handle *rad_open(void); /* Deprecated, == rad_auth_open */ +int rad_put_addr(struct rad_handle *, int, struct in_addr); +int rad_put_attr(struct rad_handle *, int, + const void *, size_t); +int rad_put_int(struct rad_handle *, int, u_int32_t); +int rad_put_string(struct rad_handle *, int, + const char *); +int rad_put_message_authentic(struct rad_handle *); +ssize_t rad_request_authenticator(struct rad_handle *, char *, + size_t); +int rad_send_request(struct rad_handle *); +const char *rad_server_secret(struct rad_handle *); +const char *rad_strerror(struct rad_handle *); +u_char *rad_demangle(struct rad_handle *, const void *, + size_t); + +__END_DECLS + +#endif /* _RADLIB_H_ */ diff --git a/src/include.new/radlib_vs.h b/src/include.new/radlib_vs.h new file mode 100644 index 0000000..c9ab743 --- /dev/null +++ b/src/include.new/radlib_vs.h @@ -0,0 +1,84 @@ +/*- + * Copyright (c) 2002 Brian Somers + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD: src/lib/libradius/radlib_vs.h,v 1.3 2004/04/27 15:00:29 ru Exp $ + */ + +#ifndef _RADLIB_VS_H_ +#define _RADLIB_VS_H_ + +#include +#include + +#define RAD_VENDOR_MICROSOFT 311 /* rfc2548 */ + #define RAD_MICROSOFT_MS_CHAP_RESPONSE 1 + #define RAD_MICROSOFT_MS_CHAP_ERROR 2 + #define RAD_MICROSOFT_MS_CHAP_PW_1 3 + #define RAD_MICROSOFT_MS_CHAP_PW_2 4 + #define RAD_MICROSOFT_MS_CHAP_LM_ENC_PW 5 + #define RAD_MICROSOFT_MS_CHAP_NT_ENC_PW 6 + #define RAD_MICROSOFT_MS_MPPE_ENCRYPTION_POLICY 7 + #define RAD_MICROSOFT_MS_MPPE_ENCRYPTION_TYPES 8 + #define RAD_MICROSOFT_MS_RAS_VENDOR 9 + #define RAD_MICROSOFT_MS_CHAP_DOMAIN 10 + #define RAD_MICROSOFT_MS_CHAP_CHALLENGE 11 + #define RAD_MICROSOFT_MS_CHAP_MPPE_KEYS 12 + #define RAD_MICROSOFT_MS_BAP_USAGE 13 + #define RAD_MICROSOFT_MS_LINK_UTILIZATION_THRESHOLD 14 + #define RAD_MICROSOFT_MS_LINK_DROP_TIME_LIMIT 15 + #define RAD_MICROSOFT_MS_MPPE_SEND_KEY 16 + #define RAD_MICROSOFT_MS_MPPE_RECV_KEY 17 + #define RAD_MICROSOFT_MS_RAS_VERSION 18 + #define RAD_MICROSOFT_MS_OLD_ARAP_PASSWORD 19 + #define RAD_MICROSOFT_MS_NEW_ARAP_PASSWORD 20 + #define RAD_MICROSOFT_MS_ARAP_PASSWORD_CHANGE_REASON 21 + #define RAD_MICROSOFT_MS_FILTER 22 + #define RAD_MICROSOFT_MS_ACCT_AUTH_TYPE 23 + #define RAD_MICROSOFT_MS_ACCT_EAP_TYPE 24 + #define RAD_MICROSOFT_MS_CHAP2_RESPONSE 25 + #define RAD_MICROSOFT_MS_CHAP2_SUCCESS 26 + #define RAD_MICROSOFT_MS_CHAP2_PW 27 + #define RAD_MICROSOFT_MS_PRIMARY_DNS_SERVER 28 + #define RAD_MICROSOFT_MS_SECONDARY_DNS_SERVER 29 + #define RAD_MICROSOFT_MS_PRIMARY_NBNS_SERVER 30 + #define RAD_MICROSOFT_MS_SECONDARY_NBNS_SERVER 31 + #define RAD_MICROSOFT_MS_ARAP_CHALLENGE 33 + +#define SALT_LEN 2 + +struct rad_handle; + +__BEGIN_DECLS +int rad_get_vendor_attr(u_int32_t *, const void **, size_t *); +int rad_put_vendor_addr(struct rad_handle *, int, int, struct in_addr); +int rad_put_vendor_attr(struct rad_handle *, int, int, const void *, + size_t); +int rad_put_vendor_int(struct rad_handle *, int, int, u_int32_t); +int rad_put_vendor_string(struct rad_handle *, int, int, const char *); +u_char *rad_demangle_mppe_key(struct rad_handle *, const void *, size_t, + size_t *); +__END_DECLS + +#endif /* _RADLIB_VS_H_ */ diff --git a/src/include.new/ranlib.h b/src/include.new/ranlib.h new file mode 100644 index 0000000..c842919 --- /dev/null +++ b/src/include.new/ranlib.h @@ -0,0 +1,50 @@ +/*- + * Copyright (c) 1990, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)ranlib.h 8.1 (Berkeley) 6/2/93 + */ + +#ifndef _RANLIB_H_ +#define _RANLIB_H_ + +#define RANLIBMAG "__.SYMDEF" /* archive file name */ +#define RANLIBSKEW 3 /* creation time offset */ + +struct ranlib { + union { + long ran_strx; /* string table index */ + char *ran_name; /* in memory symbol name */ + } ran_un; + long ran_off; /* archive file offset */ +}; + +#endif /* !_RANLIB_H_ */ diff --git a/src/include.new/readpassphrase.h b/src/include.new/readpassphrase.h new file mode 100644 index 0000000..ce28f2a --- /dev/null +++ b/src/include.new/readpassphrase.h @@ -0,0 +1,47 @@ +/* $OpenBSD: /usr/local/www/cvsroot/OpenBSD/src/include/readpassphrase.h,v 1.2 2002/02/16 21:27:17 millert Exp $ */ +/* $FreeBSD: src/include/readpassphrase.h,v 1.2 2002/03/08 20:52:52 green Exp $ */ + +/* + * Copyright (c) 2000 Todd C. Miller + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _READPASSPHRASE_H_ +#define _READPASSPHRASE_H_ + +#define RPP_ECHO_OFF 0x00 /* Turn off echo (default). */ +#define RPP_ECHO_ON 0x01 /* Leave echo on. */ +#define RPP_REQUIRE_TTY 0x02 /* Fail if there is no tty. */ +#define RPP_FORCELOWER 0x04 /* Force input to lower case. */ +#define RPP_FORCEUPPER 0x08 /* Force input to upper case. */ +#define RPP_SEVENBIT 0x10 /* Strip the high bit from input. */ + +#include + +__BEGIN_DECLS +char * readpassphrase(const char *, char *, size_t, int); +__END_DECLS + +#endif /* !_READPASSPHRASE_H_ */ diff --git a/src/include.new/regex.h b/src/include.new/regex.h new file mode 100644 index 0000000..5c072f4 --- /dev/null +++ b/src/include.new/regex.h @@ -0,0 +1,120 @@ +/*- + * Copyright (c) 1992 Henry Spencer. + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Henry Spencer of the University of Toronto. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)regex.h 8.2 (Berkeley) 1/3/94 + * $FreeBSD: src/include/regex.h,v 1.11 2004/07/12 06:07:26 tjr Exp $ + */ + +#ifndef _REGEX_H_ +#define _REGEX_H_ + +#include +#include + +/* types */ +typedef __off_t regoff_t; + +#ifndef _SIZE_T_DECLARED +typedef __size_t size_t; +#define _SIZE_T_DECLARED +#endif + +typedef struct { + int re_magic; + size_t re_nsub; /* number of parenthesized subexpressions */ + __const char *re_endp; /* end pointer for REG_PEND */ + struct re_guts *re_g; /* none of your business :-) */ +} regex_t; + +typedef struct { + regoff_t rm_so; /* start of match */ + regoff_t rm_eo; /* end of match */ +} regmatch_t; + +/* regcomp() flags */ +#define REG_BASIC 0000 +#define REG_EXTENDED 0001 +#define REG_ICASE 0002 +#define REG_NOSUB 0004 +#define REG_NEWLINE 0010 +#define REG_NOSPEC 0020 +#define REG_PEND 0040 +#define REG_DUMP 0200 + +/* regerror() flags */ +#define REG_ENOSYS (-1) +#define REG_NOMATCH 1 +#define REG_BADPAT 2 +#define REG_ECOLLATE 3 +#define REG_ECTYPE 4 +#define REG_EESCAPE 5 +#define REG_ESUBREG 6 +#define REG_EBRACK 7 +#define REG_EPAREN 8 +#define REG_EBRACE 9 +#define REG_BADBR 10 +#define REG_ERANGE 11 +#define REG_ESPACE 12 +#define REG_BADRPT 13 +#define REG_EMPTY 14 +#define REG_ASSERT 15 +#define REG_INVARG 16 +#define REG_ILLSEQ 17 +#define REG_ATOI 255 /* convert name to number (!) */ +#define REG_ITOA 0400 /* convert number to name (!) */ + +/* regexec() flags */ +#define REG_NOTBOL 00001 +#define REG_NOTEOL 00002 +#define REG_STARTEND 00004 +#define REG_TRACE 00400 /* tracing of execution */ +#define REG_LARGE 01000 /* force large representation */ +#define REG_BACKR 02000 /* force use of backref code */ + +__BEGIN_DECLS +int regcomp(regex_t * __restrict, const char * __restrict, int); +size_t regerror(int, const regex_t * __restrict, char * __restrict, size_t); +/* + * XXX forth parameter should be `regmatch_t [__restrict]', but isn't because + * of a bug in GCC 3.2 (when -std=c99 is specified) which perceives this as a + * syntax error. + */ +int regexec(const regex_t * __restrict, const char * __restrict, size_t, + regmatch_t * __restrict, int); +void regfree(regex_t *); +__END_DECLS + +#endif /* !_REGEX_H_ */ diff --git a/src/include.new/regexp.h b/src/include.new/regexp.h new file mode 100644 index 0000000..5333015 --- /dev/null +++ b/src/include.new/regexp.h @@ -0,0 +1,70 @@ +/* + * Copyright (c) 1986 by University of Toronto. + * Copyright (c) 1989, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley + * by Henry Spencer. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)regexp.h 8.1 (Berkeley) 6/2/93 + * $FreeBSD: src/include/regexp.h,v 1.2 2002/03/23 17:24:53 imp Exp $ + */ + +#ifndef _REGEXP_H_ +#define _REGEXP_H_ + +/* + * Definitions etc. for regexp(3) routines. + * + * Caveat: this is V8 regexp(3) [actually, a reimplementation thereof], + * not the System V one. + */ +#define NSUBEXP 10 +typedef struct regexp { + char *startp[NSUBEXP]; + char *endp[NSUBEXP]; + char regstart; /* Internal use only. */ + char reganch; /* Internal use only. */ + char *regmust; /* Internal use only. */ + int regmlen; /* Internal use only. */ + char program[1]; /* Unwarranted chumminess with compiler. */ +} regexp; + +#include + +__BEGIN_DECLS +regexp *regcomp(const char *); +int regexec(const regexp *, const char *); +void regsub(const regexp *, const char *, char *); +void regerror(const char *); +__END_DECLS + +#endif /* !_REGEXP_H_ */ diff --git a/src/include.new/res_update.h b/src/include.new/res_update.h new file mode 100644 index 0000000..aa91877 --- /dev/null +++ b/src/include.new/res_update.h @@ -0,0 +1,79 @@ +/*- + * Copyright (c) 1983, 1987, 1989, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* $FreeBSD: src/include/res_update.h,v 1.2.2.1 2006/07/17 10:09:54 ume Exp $ */ + +#ifndef _RES_UPDATE_H_ +#define _RES_UPDATE_H_ + +/* + * This RR-like structure is particular to UPDATE. + */ +struct ns_updrec { + struct ns_updrec *r_prev; /* prev record */ + struct ns_updrec *r_next; /* next record */ + u_int8_t r_section; /* ZONE/PREREQUISITE/UPDATE */ + char * r_dname; /* owner of the RR */ + u_int16_t r_class; /* class number */ + u_int16_t r_type; /* type number */ + u_int32_t r_ttl; /* time to live */ + u_char * r_data; /* rdata fields as text string */ + u_int16_t r_size; /* size of r_data field */ + int r_opcode; /* type of operation */ + /* following fields for private use by the resolver/server routines */ + struct ns_updrec *r_grpnext; /* next record when grouped */ + struct databuf *r_dp; /* databuf to process */ + struct databuf *r_deldp; /* databuf's deleted/overwritten */ + u_int16_t r_zone; /* zone number on server */ +}; +typedef struct ns_updrec ns_updrec; + +#define res_freeupdrec __res_freeupdrec +#define res_mkupdate __res_mkupdate +#define res_mkupdrec __res_mkupdrec +#define res_nmkupdate __res_nmkupdate +#define res_nupdate __res_nupdate +#if 0 +#define res_update __res_update +#endif + +__BEGIN_DECLS +void res_freeupdrec(ns_updrec *); +int res_mkupdate(ns_updrec *, u_char *, int); +ns_updrec * res_mkupdrec(int, const char *, u_int, u_int, u_long); +int res_nmkupdate(res_state, ns_updrec *, u_char *, int); +int res_nupdate(res_state, ns_updrec *, ns_tsig_key *); +int res_update(ns_updrec *); +__END_DECLS + +#endif /* _RES_UPDATE_H_ */ diff --git a/src/include.new/resolv.h b/src/include.new/resolv.h new file mode 100644 index 0000000..b9b71e2 --- /dev/null +++ b/src/include.new/resolv.h @@ -0,0 +1,499 @@ +/* + * Copyright (c) 1983, 1987, 1989 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC") + * Portions Copyright (c) 1996-1999 by Internet Software Consortium. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT + * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +/* + * @(#)resolv.h 8.1 (Berkeley) 6/2/93 + * $Id$ + * $FreeBSD: src/include/resolv.h,v 1.26.2.2 2006/07/17 10:09:54 ume Exp $ + */ + +#ifndef _RESOLV_H_ +#define _RESOLV_H_ + +#include +#include +#include +#include +#include +#include + +/* + * Revision information. This is the release date in YYYYMMDD format. + * It can change every day so the right thing to do with it is use it + * in preprocessor commands such as "#if (__RES > 19931104)". Do not + * compare for equality; rather, use it to determine whether your resolver + * is new enough to contain a certain feature. + */ + +#define __RES 20030124 + +/* + * This used to be defined in res_query.c, now it's in herror.c. + * [XXX no it's not. It's in irs/irs_data.c] + * It was + * never extern'd by any *.h file before it was placed here. For thread + * aware programs, the last h_errno value set is stored in res->h_errno. + * + * XXX: There doesn't seem to be a good reason for exposing RES_SET_H_ERRNO + * (and __h_errno_set) to the public via . + * XXX: __h_errno_set is really part of IRS, not part of the resolver. + * If somebody wants to build and use a resolver that doesn't use IRS, + * what do they do? Perhaps something like + * #ifdef WANT_IRS + * # define RES_SET_H_ERRNO(r,x) __h_errno_set(r,x) + * #else + * # define RES_SET_H_ERRNO(r,x) (h_errno = (r)->res_h_errno = (x)) + * #endif + */ + +#define RES_SET_H_ERRNO(r,x) __h_errno_set(r,x) +struct __res_state; /* forward */ +__BEGIN_DECLS +void __h_errno_set(struct __res_state *, int); +__END_DECLS + +/* + * Resolver configuration file. + * Normally not present, but may contain the address of the + * initial name server(s) to query and the domain search list. + */ + +#ifndef _PATH_RESCONF +#define _PATH_RESCONF "/etc/resolv.conf" +#endif + +typedef enum { res_goahead, res_nextns, res_modified, res_done, res_error } + res_sendhookact; + +typedef res_sendhookact (*res_send_qhook)(struct sockaddr * const *, + const u_char **, int *, + u_char *, int, int *); + +typedef res_sendhookact (*res_send_rhook)(const struct sockaddr *, + const u_char *, int, u_char *, + int, int *); + +struct res_sym { + int number; /* Identifying number, like T_MX */ + const char * name; /* Its symbolic name, like "MX" */ + const char * humanname; /* Its fun name, like "mail exchanger" */ +}; + +/* + * Global defines and variables for resolver stub. + */ +#define MAXNS 3 /* max # name servers we'll track */ +#define MAXDFLSRCH 3 /* # default domain levels to try */ +#define MAXDNSRCH 6 /* max # domains in search path */ +#define LOCALDOMAINPARTS 2 /* min levels in name that is "local" */ + +#define RES_TIMEOUT 5 /* min. seconds between retries */ +#define MAXRESOLVSORT 10 /* number of net to sort on */ +#define RES_MAXNDOTS 15 /* should reflect bit field size */ +#define RES_MAXRETRANS 30 /* only for resolv.conf/RES_OPTIONS */ +#define RES_MAXRETRY 5 /* only for resolv.conf/RES_OPTIONS */ +#define RES_DFLRETRY 2 /* Default #/tries. */ +#define RES_MAXTIME 65535 /* Infinity, in milliseconds. */ + +struct __res_state_ext; + +struct __res_state { + int retrans; /* retransmission time interval */ + int retry; /* number of times to retransmit */ + /* + * XXX: If `sun' is defined, `options' and `pfcode' are + * defined as u_int in original BIND9 distribution. However, + * it breaks binary backward compatibility against FreeBSD's + * resolver. So, we changed not to see `sun'. + */ +#if defined(sun) && 0 + u_int options; /* option flags - see below. */ +#else + u_long options; /* option flags - see below. */ +#endif + int nscount; /* number of name servers */ + struct sockaddr_in + nsaddr_list[MAXNS]; /* address of name server */ +#define nsaddr nsaddr_list[0] /* for backward compatibility */ + u_short id; /* current message id */ + char *dnsrch[MAXDNSRCH+1]; /* components of domain to search */ + char defdname[256]; /* default domain (deprecated) */ +#if defined(sun) && 0 + u_int pfcode; /* RES_PRF_ flags - see below. */ +#else + u_long pfcode; /* RES_PRF_ flags - see below. */ +#endif + unsigned ndots:4; /* threshold for initial abs. query */ + unsigned nsort:4; /* number of elements in sort_list[] */ + char unused[3]; + struct { + struct in_addr addr; + u_int32_t mask; + } sort_list[MAXRESOLVSORT]; + res_send_qhook qhook; /* query hook */ + res_send_rhook rhook; /* response hook */ + int res_h_errno; /* last one set for this context */ + int _vcsock; /* PRIVATE: for res_send VC i/o */ + u_int _flags; /* PRIVATE: see below */ + u_int _pad; /* make _u 64 bit aligned */ + union { + /* On an 32-bit arch this means 512b total. */ + char pad[72 - 4*sizeof (int) - 2*sizeof (void *)]; + struct { + u_int16_t nscount; + u_int16_t nstimes[MAXNS]; /* ms. */ + int nssocks[MAXNS]; + struct __res_state_ext *ext; /* extention for IPv6 */ + } _ext; + } _u; +}; + +typedef struct __res_state *res_state; + +union res_sockaddr_union { + struct sockaddr_in sin; +#ifdef IN6ADDR_ANY_INIT + struct sockaddr_in6 sin6; +#endif +#ifdef ISC_ALIGN64 + int64_t __align64; /* 64bit alignment */ +#else + int32_t __align32; /* 32bit alignment */ +#endif + char __space[128]; /* max size */ +}; + +/* + * Resolver flags (used to be discrete per-module statics ints). + */ +#define RES_F_VC 0x00000001 /* socket is TCP */ +#define RES_F_CONN 0x00000002 /* socket is connected */ +#define RES_F_EDNS0ERR 0x00000004 /* EDNS0 caused errors */ +#define RES_F__UNUSED 0x00000008 /* (unused) */ +#define RES_F_LASTMASK 0x000000F0 /* ordinal server of last res_nsend */ +#define RES_F_LASTSHIFT 4 /* bit position of LASTMASK "flag" */ +#define RES_GETLAST(res) (((res)._flags & RES_F_LASTMASK) >> RES_F_LASTSHIFT) + +/* res_findzonecut2() options */ +#define RES_EXHAUSTIVE 0x00000001 /* always do all queries */ +#define RES_IPV4ONLY 0x00000002 /* IPv4 only */ +#define RES_IPV6ONLY 0x00000004 /* IPv6 only */ + +/* + * Resolver options (keep these in synch with res_debug.c, please) + */ +#define RES_INIT 0x00000001 /* address initialized */ +#define RES_DEBUG 0x00000002 /* print debug messages */ +#define RES_AAONLY 0x00000004 /* authoritative answers only (!IMPL)*/ +#define RES_USEVC 0x00000008 /* use virtual circuit */ +#define RES_PRIMARY 0x00000010 /* query primary server only (!IMPL) */ +#define RES_IGNTC 0x00000020 /* ignore truncation errors */ +#define RES_RECURSE 0x00000040 /* recursion desired */ +#define RES_DEFNAMES 0x00000080 /* use default domain name */ +#define RES_STAYOPEN 0x00000100 /* Keep TCP socket open */ +#define RES_DNSRCH 0x00000200 /* search up local domain tree */ +#define RES_INSECURE1 0x00000400 /* type 1 security disabled */ +#define RES_INSECURE2 0x00000800 /* type 2 security disabled */ +#define RES_NOALIASES 0x00001000 /* shuts off HOSTALIASES feature */ +#define RES_USE_INET6 0x00002000 /* use/map IPv6 in gethostbyname() */ +#define RES_ROTATE 0x00004000 /* rotate ns list after each query */ +#define RES_NOCHECKNAME 0x00008000 /* do not check names for sanity. */ +#define RES_KEEPTSIG 0x00010000 /* do not strip TSIG records */ +#define RES_BLAST 0x00020000 /* blast all recursive servers */ +#define RES_NOTLDQUERY 0x00100000 /* don't unqualified name as a tld */ +#define RES_USE_DNSSEC 0x00200000 /* use DNSSEC using OK bit in OPT */ +/* #define RES_DEBUG2 0x00400000 */ /* nslookup internal */ +/* KAME extensions: use higher bit to avoid conflict with ISC use */ +#define RES_USE_DNAME 0x10000000 /* use DNAME */ +#define RES_USE_EDNS0 0x40000000 /* use EDNS0 if configured */ +#define RES_NO_NIBBLE2 0x80000000 /* disable alternate nibble lookup */ + +#define RES_DEFAULT (RES_RECURSE | RES_DEFNAMES | \ + RES_DNSRCH | RES_NO_NIBBLE2) + +/* + * Resolver "pfcode" values. Used by dig. + */ +#define RES_PRF_STATS 0x00000001 +#define RES_PRF_UPDATE 0x00000002 +#define RES_PRF_CLASS 0x00000004 +#define RES_PRF_CMD 0x00000008 +#define RES_PRF_QUES 0x00000010 +#define RES_PRF_ANS 0x00000020 +#define RES_PRF_AUTH 0x00000040 +#define RES_PRF_ADD 0x00000080 +#define RES_PRF_HEAD1 0x00000100 +#define RES_PRF_HEAD2 0x00000200 +#define RES_PRF_TTLID 0x00000400 +#define RES_PRF_HEADX 0x00000800 +#define RES_PRF_QUERY 0x00001000 +#define RES_PRF_REPLY 0x00002000 +#define RES_PRF_INIT 0x00004000 +#define RES_PRF_TRUNC 0x00008000 +/* 0x00010000 */ + +/* Things involving an internal (static) resolver context. */ +__BEGIN_DECLS +extern struct __res_state *__res_state(void); +__END_DECLS +#define _res (*__res_state()) + +#ifndef __BIND_NOSTATIC +#define fp_nquery __fp_nquery +#define fp_query __fp_query +#define hostalias __hostalias +#define p_query __p_query +#define res_close __res_close +#define res_init __res_init +#define res_isourserver __res_isourserver +#define res_mkquery __res_mkquery +#define res_opt __res_opt +#define res_query __res_query +#define res_querydomain __res_querydomain +#define res_search __res_search +#define res_send __res_send +#define res_sendsigned __res_sendsigned + +__BEGIN_DECLS +void fp_nquery(const u_char *, int, FILE *); +void fp_query(const u_char *, FILE *); +const char * hostalias(const char *); +void p_query(const u_char *); +void res_close(void); +int res_init(void); +int res_isourserver(const struct sockaddr_in *); +int res_mkquery(int, const char *, int, int, const u_char *, + int, const u_char *, u_char *, int); +int res_opt(int, u_char *, int, int); +int res_query(const char *, int, int, u_char *, int); +int res_querydomain(const char *, const char *, int, int, + u_char *, int); +int res_search(const char *, int, int, u_char *, int); +int res_send(const u_char *, int, u_char *, int); +int res_sendsigned(const u_char *, int, ns_tsig_key *, + u_char *, int); +__END_DECLS +#endif + +#if !defined(SHARED_LIBBIND) || defined(LIB) +/* + * If libbind is a shared object (well, DLL anyway) + * these externs break the linker when resolv.h is + * included by a lib client (like named) + * Make them go away if a client is including this + * + */ +extern const struct res_sym __p_key_syms[]; +extern const struct res_sym __p_cert_syms[]; +extern const struct res_sym __p_class_syms[]; +extern const struct res_sym __p_type_syms[]; +extern const struct res_sym __p_rcode_syms[]; +#endif /* SHARED_LIBBIND */ + +#define b64_ntop __b64_ntop +#define b64_pton __b64_pton +#define dn_comp __dn_comp +#define dn_count_labels __dn_count_labels +#define dn_expand __dn_expand +#define dn_skipname __dn_skipname +#define fp_resstat __fp_resstat +#define loc_aton __loc_aton +#define loc_ntoa __loc_ntoa +#define p_cdname __p_cdname +#define p_cdnname __p_cdnname +#define p_class __p_class +#define p_fqname __p_fqname +#define p_fqnname __p_fqnname +#define p_option __p_option +#define p_secstodate __p_secstodate +#define p_section __p_section +#define p_time __p_time +#define p_type __p_type +#define p_rcode __p_rcode +#define p_sockun __p_sockun +#define putlong __putlong +#define putshort __putshort +#define res_dnok __res_dnok +#if 0 +#define res_findzonecut __res_findzonecut +#define res_findzonecut2 __res_findzonecut2 +#endif +#define res_hnok __res_hnok +#define res_hostalias __res_hostalias +#define res_mailok __res_mailok +#define res_nameinquery __res_nameinquery +#define res_nclose __res_nclose +#define res_ninit __res_ninit +#define res_nmkquery __res_nmkquery +#define res_pquery __res_pquery +#define res_nquery __res_nquery +#define res_nquerydomain __res_nquerydomain +#define res_nsearch __res_nsearch +#define res_nsend __res_nsend +#if 0 +#define res_nsendsigned __res_nsendsigned +#endif +#define res_nisourserver __res_nisourserver +#define res_ownok __res_ownok +#define res_queriesmatch __res_queriesmatch +#define res_randomid __res_randomid +#define sym_ntop __sym_ntop +#define sym_ntos __sym_ntos +#define sym_ston __sym_ston +#define res_nopt __res_nopt +#define res_ndestroy __res_ndestroy +#define res_nametoclass __res_nametoclass +#define res_nametotype __res_nametotype +#define res_setservers __res_setservers +#define res_getservers __res_getservers +#if 0 +#define res_buildprotolist __res_buildprotolist +#define res_destroyprotolist __res_destroyprotolist +#define res_destroyservicelist __res_destroyservicelist +#define res_get_nibblesuffix __res_get_nibblesuffix +#define res_get_nibblesuffix2 __res_get_nibblesuffix2 +#endif +#define res_ourserver_p __res_ourserver_p +#if 0 +#define res_protocolname __res_protocolname +#define res_protocolnumber __res_protocolnumber +#endif +#define res_send_setqhook __res_send_setqhook +#define res_send_setrhook __res_send_setrhook +#if 0 +#define res_servicename __res_servicename +#define res_servicenumber __res_servicenumber +#endif +__BEGIN_DECLS +int res_hnok(const char *); +int res_ownok(const char *); +int res_mailok(const char *); +int res_dnok(const char *); +int sym_ston(const struct res_sym *, const char *, int *); +const char * sym_ntos(const struct res_sym *, int, int *); +const char * sym_ntop(const struct res_sym *, int, int *); +int b64_ntop(u_char const *, size_t, char *, size_t); +int b64_pton(char const *, u_char *, size_t); +int loc_aton(const char *, u_char *); +const char * loc_ntoa(const u_char *, char *); +int dn_skipname(const u_char *, const u_char *); +void putlong(u_int32_t, u_char *); +void putshort(u_int16_t, u_char *); +#ifndef __ultrix__ +u_int16_t _getshort(const u_char *); +u_int32_t _getlong(const u_char *); +#endif +const char * p_class(int); +const char * p_time(u_int32_t); +const char * p_type(int); +const char * p_rcode(int); +const char * p_sockun(union res_sockaddr_union, char *, size_t); +const u_char * p_cdnname(const u_char *, const u_char *, int, FILE *); +const u_char * p_cdname(const u_char *, const u_char *, FILE *); +const u_char * p_fqnname(const u_char *, const u_char *, int, char *, int); +const u_char * p_fqname(const u_char *, const u_char *, FILE *); +const char * p_option(u_long); +char * p_secstodate(u_long); +int dn_count_labels(const char *); +int dn_comp(const char *, u_char *, int, u_char **, u_char **); +int dn_expand(const u_char *, const u_char *, const u_char *, + char *, int); +u_int res_randomid(void); +int res_nameinquery(const char *, int, int, const u_char *, + const u_char *); +int res_queriesmatch(const u_char *, const u_char *, + const u_char *, const u_char *); +const char * p_section(int, int); +/* Things involving a resolver context. */ +int res_ninit(res_state); +int res_nisourserver(const res_state, const struct sockaddr_in *); +void fp_resstat(const res_state, FILE *); +void res_pquery(const res_state, const u_char *, int, FILE *); +const char * res_hostalias(const res_state, const char *, char *, size_t); +int res_nquery(res_state, const char *, int, int, u_char *, int); +int res_nsearch(res_state, const char *, int, int, u_char *, int); +int res_nquerydomain(res_state, const char *, const char *, + int, int, u_char *, int); +int res_nmkquery(res_state, int, const char *, int, int, + const u_char *, int, const u_char *, + u_char *, int); +int res_nsend(res_state, const u_char *, int, u_char *, int); +#if 0 +int res_nsendsigned(res_state, const u_char *, int, + ns_tsig_key *, u_char *, int); +int res_findzonecut(res_state, const char *, ns_class, int, + char *, size_t, struct in_addr *, int); +int res_findzonecut2(res_state, const char *, ns_class, int, + char *, size_t, + union res_sockaddr_union *, int); +#endif +void res_nclose(res_state); +int res_nopt(res_state, int, u_char *, int, int); +void res_send_setqhook(res_send_qhook); +void res_send_setrhook(res_send_rhook); +int __res_vinit(res_state, int); +#if 0 +void res_destroyservicelist(void); +const char * res_servicename(u_int16_t, const char *); +const char * res_protocolname(int); +void res_destroyprotolist(void); +void res_buildprotolist(void); +const char * res_get_nibblesuffix(res_state); +const char * res_get_nibblesuffix2(res_state); +#endif +void res_ndestroy(res_state); +u_int16_t res_nametoclass(const char *, int *); +u_int16_t res_nametotype(const char *, int *); +void res_setservers(res_state, const union res_sockaddr_union *, + int); +int res_getservers(res_state, union res_sockaddr_union *, int); +__END_DECLS + +#endif /* !_RESOLV_H_ */ diff --git a/src/include.new/ripemd.h b/src/include.new/ripemd.h new file mode 100644 index 0000000..ca13e62 --- /dev/null +++ b/src/include.new/ripemd.h @@ -0,0 +1,94 @@ +/* crypto/ripemd/ripemd.h */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +/* + * $FreeBSD: src/lib/libmd/ripemd.h,v 1.2 2001/03/17 10:00:50 phk Exp $ + */ + +#ifndef HEADER_RIPEMD_H +#define HEADER_RIPEMD_H + +#include +#include /* XXX switch to machine/ansi.h and __ types */ + +#define RIPEMD160_CBLOCK 64 +#define RIPEMD160_LBLOCK 16 +#define RIPEMD160_BLOCK 16 +#define RIPEMD160_LAST_BLOCK 56 +#define RIPEMD160_LENGTH_BLOCK 8 +#define RIPEMD160_DIGEST_LENGTH 20 + +typedef struct RIPEMD160state_st { + u_int32_t A,B,C,D,E; + u_int32_t Nl,Nh; + u_int32_t data[RIPEMD160_LBLOCK]; + int num; +} RIPEMD160_CTX; + +__BEGIN_DECLS +void RIPEMD160_Init(RIPEMD160_CTX *c); +void RIPEMD160_Update(RIPEMD160_CTX *c, const unsigned char *data, + size_t len); +void RIPEMD160_Final(unsigned char *md, RIPEMD160_CTX *c); +char *RIPEMD160_End(RIPEMD160_CTX *, char *); +char *RIPEMD160_File(const char *, char *); +char *RIPEMD160_FileChunk(const char *, char *, off_t, off_t); +char *RIPEMD160_Data(const unsigned char *, unsigned int, char *); +__END_DECLS + +#endif diff --git a/src/include.new/roken-common.h b/src/include.new/roken-common.h new file mode 100644 index 0000000..f1e5ed8 --- /dev/null +++ b/src/include.new/roken-common.h @@ -0,0 +1,338 @@ +/* + * Copyright (c) 1995 - 2002 Kungliga Tekniska H�gskolan + * (Royal Institute of Technology, Stockholm, Sweden). + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of the Institute nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* $Id$ */ + +#ifndef __ROKEN_COMMON_H__ +#define __ROKEN_COMMON_H__ + +#ifdef __cplusplus +#define ROKEN_CPP_START extern "C" { +#define ROKEN_CPP_END } +#else +#define ROKEN_CPP_START +#define ROKEN_CPP_END +#endif + +#ifndef INADDR_NONE +#define INADDR_NONE 0xffffffff +#endif + +#ifndef INADDR_LOOPBACK +#define INADDR_LOOPBACK 0x7f000001 +#endif + +#ifndef SOMAXCONN +#define SOMAXCONN 5 +#endif + +#ifndef STDIN_FILENO +#define STDIN_FILENO 0 +#endif + +#ifndef STDOUT_FILENO +#define STDOUT_FILENO 1 +#endif + +#ifndef STDERR_FILENO +#define STDERR_FILENO 2 +#endif + +#ifndef max +#define max(a,b) (((a)>(b))?(a):(b)) +#endif + +#ifndef min +#define min(a,b) (((a)<(b))?(a):(b)) +#endif + +#ifndef TRUE +#define TRUE 1 +#endif + +#ifndef FALSE +#define FALSE 0 +#endif + +#ifndef LOG_DAEMON +#define openlog(id,option,facility) openlog((id),(option)) +#define LOG_DAEMON 0 +#endif +#ifndef LOG_ODELAY +#define LOG_ODELAY 0 +#endif +#ifndef LOG_NDELAY +#define LOG_NDELAY 0x08 +#endif +#ifndef LOG_CONS +#define LOG_CONS 0 +#endif +#ifndef LOG_AUTH +#define LOG_AUTH 0 +#endif +#ifndef LOG_AUTHPRIV +#define LOG_AUTHPRIV LOG_AUTH +#endif + +#ifndef F_OK +#define F_OK 0 +#endif + +#ifndef O_ACCMODE +#define O_ACCMODE 003 +#endif + +#ifndef _PATH_DEV +#define _PATH_DEV "/dev/" +#endif + +#ifndef _PATH_DEVNULL +#define _PATH_DEVNULL "/dev/null" +#endif + +#ifndef _PATH_HEQUIV +#define _PATH_HEQUIV "/etc/hosts.equiv" +#endif + +#ifndef _PATH_VARRUN +#define _PATH_VARRUN "/var/run/" +#endif + +#ifndef _PATH_BSHELL +#define _PATH_BSHELL "/bin/sh" +#endif + +#ifndef MAXPATHLEN +#define MAXPATHLEN (1024+4) +#endif + +#ifndef SIG_ERR +#define SIG_ERR ((RETSIGTYPE (*)(int))-1) +#endif + +/* + * error code for getipnodeby{name,addr} + */ + +#ifndef HOST_NOT_FOUND +#define HOST_NOT_FOUND 1 +#endif + +#ifndef TRY_AGAIN +#define TRY_AGAIN 2 +#endif + +#ifndef NO_RECOVERY +#define NO_RECOVERY 3 +#endif + +#ifndef NO_DATA +#define NO_DATA 4 +#endif + +#ifndef NO_ADDRESS +#define NO_ADDRESS NO_DATA +#endif + +/* + * error code for getaddrinfo + */ + +#ifndef EAI_NOERROR +#define EAI_NOERROR 0 /* no error */ +#endif + +#ifndef EAI_NONAME + +#define EAI_ADDRFAMILY 1 /* address family for nodename not supported */ +#define EAI_AGAIN 2 /* temporary failure in name resolution */ +#define EAI_BADFLAGS 3 /* invalid value for ai_flags */ +#define EAI_FAIL 4 /* non-recoverable failure in name resolution */ +#define EAI_FAMILY 5 /* ai_family not supported */ +#define EAI_MEMORY 6 /* memory allocation failure */ +#define EAI_NODATA 7 /* no address associated with nodename */ +#define EAI_NONAME 8 /* nodename nor servname provided, or not known */ +#define EAI_SERVICE 9 /* servname not supported for ai_socktype */ +#define EAI_SOCKTYPE 10 /* ai_socktype not supported */ +#define EAI_SYSTEM 11 /* system error returned in errno */ + +#endif /* EAI_NONAME */ + +/* flags for getaddrinfo() */ + +#ifndef AI_PASSIVE +#define AI_PASSIVE 0x01 +#define AI_CANONNAME 0x02 +#endif /* AI_PASSIVE */ + +#ifndef AI_NUMERICHOST +#define AI_NUMERICHOST 0x04 +#endif + +/* flags for getnameinfo() */ + +#ifndef NI_DGRAM +#define NI_DGRAM 0x01 +#define NI_NAMEREQD 0x02 +#define NI_NOFQDN 0x04 +#define NI_NUMERICHOST 0x08 +#define NI_NUMERICSERV 0x10 +#endif + +/* + * constants for getnameinfo + */ + +#ifndef NI_MAXHOST +#define NI_MAXHOST 1025 +#define NI_MAXSERV 32 +#endif + +/* + * constants for inet_ntop + */ + +#ifndef INET_ADDRSTRLEN +#define INET_ADDRSTRLEN 16 +#endif + +#ifndef INET6_ADDRSTRLEN +#define INET6_ADDRSTRLEN 46 +#endif + +/* + * for shutdown(2) + */ + +#ifndef SHUT_RD +#define SHUT_RD 0 +#endif + +#ifndef SHUT_WR +#define SHUT_WR 1 +#endif + +#ifndef SHUT_RDWR +#define SHUT_RDWR 2 +#endif + +#ifndef HAVE___ATTRIBUTE__ +#define __attribute__(x) +#endif + +ROKEN_CPP_START + +#ifndef IRIX4 /* fix for compiler bug */ +#ifdef RETSIGTYPE +typedef RETSIGTYPE (*SigAction)(int); +SigAction signal(int iSig, SigAction pAction); /* BSD compatible */ +#endif +#endif + +int ROKEN_LIB_FUNCTION simple_execve(const char*, char*const[], char*const[]); +int ROKEN_LIB_FUNCTION simple_execvp(const char*, char *const[]); +int ROKEN_LIB_FUNCTION simple_execlp(const char*, ...); +int ROKEN_LIB_FUNCTION simple_execle(const char*, ...); +int ROKEN_LIB_FUNCTION simple_execl(const char *file, ...); + +int ROKEN_LIB_FUNCTION wait_for_process(pid_t); +int ROKEN_LIB_FUNCTION pipe_execv(FILE**, FILE**, FILE**, const char*, ...); + +void ROKEN_LIB_FUNCTION print_version(const char *); + +ssize_t ROKEN_LIB_FUNCTION eread (int fd, void *buf, size_t nbytes); +ssize_t ROKEN_LIB_FUNCTION ewrite (int fd, const void *buf, size_t nbytes); + +struct hostent; + +const char * +hostent_find_fqdn (const struct hostent *he); + +void +esetenv(const char *var, const char *val, int rewrite); + +void +socket_set_address_and_port (struct sockaddr *sa, const void *ptr, int port); + +size_t +socket_addr_size (const struct sockaddr *sa); + +void +socket_set_any (struct sockaddr *sa, int af); + +size_t +socket_sockaddr_size (const struct sockaddr *sa); + +void * +socket_get_address (struct sockaddr *sa); + +int +socket_get_port (const struct sockaddr *sa); + +void +socket_set_port (struct sockaddr *sa, int port); + +void +socket_set_portrange (int sock, int restr, int af); + +void +socket_set_debug (int sock); + +void +socket_set_tos (int sock, int tos); + +void +socket_set_reuseaddr (int sock, int val); + +char ** +vstrcollect(va_list *ap); + +char ** +strcollect(char *first, ...); + +void timevalfix(struct timeval *t1); +void timevaladd(struct timeval *t1, const struct timeval *t2); +void timevalsub(struct timeval *t1, const struct timeval *t2); + +char *pid_file_write (const char *progname); +void pid_file_delete (char **); + +int +read_environment(const char *file, char ***env); + +void warnerr(int doerrno, const char *fmt, va_list ap) + __attribute__ ((format (printf, 2, 0))); + +ROKEN_CPP_END + +#endif /* __ROKEN_COMMON_H__ */ diff --git a/src/include.new/roken.h b/src/include.new/roken.h new file mode 100644 index 0000000..f020072 --- /dev/null +++ b/src/include.new/roken.h @@ -0,0 +1,244 @@ +/* This is an OS dependent, generated file */ + + +#ifndef __ROKEN_H__ +#define __ROKEN_H__ + +/* -*- C -*- */ +/* + * Copyright (c) 1995 - 2002 Kungliga Tekniska H�gskolan + * (Royal Institute of Technology, Stockholm, Sweden). + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of the Institute nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* $Id$ */ + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + + +#define ROKEN_LIB_FUNCTION + + +#include + +ROKEN_CPP_START + + + + + + + + + + +int asnprintf (char **ret, size_t max_sz, const char *format, ...) + __attribute__ ((format (printf, 3, 4))); + +int vasnprintf (char **ret, size_t max_sz, const char *format, va_list ap) + __attribute__((format (printf, 3, 0))); + + +char * strndup(const char *old, size_t sz); + +char * strlwr(char *); + +size_t strnlen(const char*, size_t); + + +ssize_t strsep_copy(const char**, const char*, char*, size_t); + + + + +char * strupr(char *); + + + + + + + + + + + +#include +struct passwd *k_getpwnam (const char *user); +struct passwd *k_getpwuid (uid_t uid); + +const char *get_default_username (void); + + + + + + + + + + + + + + + + + + +void pidfile (const char*); + +unsigned int bswap32(unsigned int); + +unsigned short bswap16(unsigned short); + + +time_t tm2time (struct tm tm, int local); + +int unix_verify_user(char *user, char *password); + +int roken_concat (char *s, size_t len, ...); + +size_t roken_mconcat (char **s, size_t max_len, ...); + +int roken_vconcat (char *s, size_t len, va_list args); + +size_t roken_vmconcat (char **s, size_t max_len, va_list args); + +ssize_t net_write (int fd, const void *buf, size_t nbytes); + +ssize_t net_read (int fd, void *buf, size_t nbytes); + +int issuid(void); + + +int get_window_size(int fd, struct winsize *); + + + +extern const char *__progname; + +extern char **environ; + + + + +struct hostent * +copyhostent (const struct hostent *h); + + + + + + + + +int +getnameinfo_verified(const struct sockaddr *sa, socklen_t salen, + char *host, size_t hostlen, + char *serv, size_t servlen, + int flags); + +int roken_getaddrinfo_hostspec(const char *, int, struct addrinfo **); +int roken_getaddrinfo_hostspec2(const char *, int, int, struct addrinfo **); + + + +void *emalloc (size_t); +void *ecalloc(size_t num, size_t sz); +void *erealloc (void *, size_t); +char *estrdup (const char *); + +/* + * kludges and such + */ + +int roken_gethostby_setup(const char*, const char*); +struct hostent* roken_gethostbyname(const char*); +struct hostent* roken_gethostbyaddr(const void*, size_t, int); + +#define roken_getservbyname(x,y) getservbyname(x,y) + +#define roken_openlog(a,b,c) openlog(a,b,c) + +#define roken_getsockname(a,b,c) getsockname(a,b,c) + + + +void mini_inetd_addrinfo (struct addrinfo*); +void mini_inetd (int port); + +void set_progname(char *argv0); +const char *get_progname(void); + + +int +strsvis(char *dst, const char *src, int flag, const char *extra); + + + + +char * +svis(char *dst, int c, int flag, int nextc, const char *extra); + + + +ROKEN_CPP_END +#define ROKEN_VERSION 0.6.3 + +#endif /* __ROKEN_H__ */ diff --git a/src/include.new/rpoll.h b/src/include.new/rpoll.h new file mode 100644 index 0000000..baa11b2 --- /dev/null +++ b/src/include.new/rpoll.h @@ -0,0 +1,66 @@ +/* + * Copyright (c)1996-2002 by Hartmut Brandt + * All rights reserved. + * + * Author: Hartmut Brandt + * + * Redistribution of this software and documentation and use in source and + * binary forms, with or without modification, are permitted provided that + * the following conditions are met: + * + * 1. Redistributions of source code or documentation must retain the above + * copyright notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE AND DOCUMENTATION IS PROVIDED BY THE AUTHOR + * AND ITS CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * THE AUTHOR OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, + * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +/* + * $Begemot: libbegemot/rpoll.h,v 1.5 2004/09/21 15:49:26 brandt Exp $ + */ +# ifndef rpoll_h_ +# define rpoll_h_ + +# ifdef __cplusplus +extern "C" { +# endif + +typedef void (*poll_f)(int fd, int mask, void *arg); +typedef void (*timer_f)(int, void *); + +int poll_register(int fd, poll_f func, void *arg, int mask); +void poll_unregister(int); +void poll_dispatch(int wait); +int poll_start_timer(u_int msecs, int repeat, timer_f func, void *arg); +void poll_stop_timer(int); + +# if defined(POLL_IN) +# undef POLL_IN +# endif +# if defined(POLL_OUT) +# undef POLL_OUT +# endif + +# define POLL_IN 1 +# define POLL_OUT 2 +# define POLL_EXCEPT 4 + +extern int rpoll_policy; +extern int rpoll_trace; + +# ifdef __cplusplus +} +# endif + +# endif diff --git a/src/include.new/runetype.h b/src/include.new/runetype.h new file mode 100644 index 0000000..f3054fa --- /dev/null +++ b/src/include.new/runetype.h @@ -0,0 +1,94 @@ +/*- + * Copyright (c) 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Paul Borman at Krystal Technologies. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)runetype.h 8.1 (Berkeley) 6/2/93 + * $FreeBSD: src/include/runetype.h,v 1.9 2004/06/23 07:01:43 tjr Exp $ + */ + +#ifndef _RUNETYPE_H_ +#define _RUNETYPE_H_ + +#include +#include + +#define _CACHED_RUNES (1 <<8 ) /* Must be a power of 2 */ +#define _CRMASK (~(_CACHED_RUNES - 1)) + +/* + * The lower 8 bits of runetype[] contain the digit value of the rune. + */ +typedef struct { + __rune_t __min; /* First rune of the range */ + __rune_t __max; /* Last rune (inclusive) of the range */ + __rune_t __map; /* What first maps to in maps */ + unsigned long *__types; /* Array of types in range */ +} _RuneEntry; + +typedef struct { + int __nranges; /* Number of ranges stored */ + _RuneEntry *__ranges; /* Pointer to the ranges */ +} _RuneRange; + +typedef struct { + char __magic[8]; /* Magic saying what version we are */ + char __encoding[32]; /* ASCII name of this encoding */ + + __rune_t (*__sgetrune)(const char *, __size_t, char const **); + int (*__sputrune)(__rune_t, char *, __size_t, char **); + __rune_t __invalid_rune; + + unsigned long __runetype[_CACHED_RUNES]; + __rune_t __maplower[_CACHED_RUNES]; + __rune_t __mapupper[_CACHED_RUNES]; + + /* + * The following are to deal with Runes larger than _CACHED_RUNES - 1. + * Their data is actually contiguous with this structure so as to make + * it easier to read/write from/to disk. + */ + _RuneRange __runetype_ext; + _RuneRange __maplower_ext; + _RuneRange __mapupper_ext; + + void *__variable; /* Data which depends on the encoding */ + int __variable_len; /* how long that data is */ +} _RuneLocale; + +#define _RUNE_MAGIC_1 "RuneMagi" /* Indicates version 0 of RuneLocale */ + +extern _RuneLocale _DefaultRuneLocale; +extern _RuneLocale *_CurrentRuneLocale; + +#endif /* !_RUNETYPE_H_ */ diff --git a/src/include.new/sched.h b/src/include.new/sched.h new file mode 100644 index 0000000..0079d9a --- /dev/null +++ b/src/include.new/sched.h @@ -0,0 +1,77 @@ +/*- + * Copyright (c) 1996, 1997 + * HD Associates, Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by HD Associates, Inc + * and Jukka Antero Ukkonen. + * 4. Neither the name of the author nor the names of any co-contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY HD ASSOCIATES AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL HD ASSOCIATES OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD: src/sys/posix4/sched.h,v 1.7 2002/10/03 06:27:50 mike Exp $ + */ + +/* sched.h: POSIX 1003.1b Process Scheduling header */ + +#ifndef _SCHED_H_ +#define _SCHED_H_ + +#include + +#ifndef _PID_T_DECLARED +typedef __pid_t pid_t; +#define _PID_T_DECLARED +#endif + +/* + * Scheduling policies + */ +#define SCHED_FIFO 1 +#define SCHED_OTHER 2 +#define SCHED_RR 3 + +struct sched_param { + int sched_priority; +}; + +#ifndef _KERNEL +#include + +struct timespec; + +__BEGIN_DECLS +int sched_get_priority_max(int); +int sched_get_priority_min(int); +int sched_getparam(pid_t, struct sched_param *); +int sched_getscheduler(pid_t); +int sched_rr_get_interval(pid_t, struct timespec *); +int sched_setparam(pid_t, const struct sched_param *); +int sched_setscheduler(pid_t, int, const struct sched_param *); +int sched_yield(void); +__END_DECLS + +#endif + +#endif /* !_SCHED_H_ */ diff --git a/src/include.new/sdp.h b/src/include.new/sdp.h new file mode 100644 index 0000000..128f30a --- /dev/null +++ b/src/include.new/sdp.h @@ -0,0 +1,653 @@ +/* + * sdp.h + * + * Copyright (c) 2001-2003 Maksim Yevmenkin + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $Id$ + * $FreeBSD: src/lib/libsdp/sdp.h,v 1.5.2.1 2006/06/09 20:56:37 emax Exp $ + */ + +#ifndef _SDP_H_ +#define _SDP_H_ + +__BEGIN_DECLS + +/* + * Data representation (page 349) + */ + +/* Nil, the null type */ +#define SDP_DATA_NIL 0x00 + +/* Unsigned integer */ +#define SDP_DATA_UINT8 0x08 +#define SDP_DATA_UINT16 0x09 +#define SDP_DATA_UINT32 0x0A +#define SDP_DATA_UINT64 0x0B +#define SDP_DATA_UINT128 0x0C + +/* Signed two's-complement integer */ +#define SDP_DATA_INT8 0x10 +#define SDP_DATA_INT16 0x11 +#define SDP_DATA_INT32 0x12 +#define SDP_DATA_INT64 0x13 +#define SDP_DATA_INT128 0x14 + +/* UUID, a universally unique identifier */ +#define SDP_DATA_UUID16 0x19 +#define SDP_DATA_UUID32 0x1A +#define SDP_DATA_UUID128 0x1C + +/* Text string */ +#define SDP_DATA_STR8 0x25 +#define SDP_DATA_STR16 0x26 +#define SDP_DATA_STR32 0x27 + +/* Boolean */ +#define SDP_DATA_BOOL 0x28 + +/* + * Data element sequence. + * A data element whose data field is a sequence of data elements + */ +#define SDP_DATA_SEQ8 0x35 +#define SDP_DATA_SEQ16 0x36 +#define SDP_DATA_SEQ32 0x37 + +/* + * Data element alternative. + * A data element whose data field is a sequence of data elements from + * which one data element is to be selected. + */ +#define SDP_DATA_ALT8 0x3D +#define SDP_DATA_ALT16 0x3E +#define SDP_DATA_ALT32 0x3F + +/* URL, a uniform resource locator */ +#define SDP_DATA_URL8 0x45 +#define SDP_DATA_URL16 0x46 +#define SDP_DATA_URL32 0x47 + +/* + * Protocols UUID (short) http://www.bluetoothsig.org/assigned-numbers/sdp.htm + * BASE UUID 00000000-0000-1000-8000-00805F9B34FB + */ + +#define SDP_UUID_PROTOCOL_SDP 0x0001 +#define SDP_UUID_PROTOCOL_UDP 0x0002 +#define SDP_UUID_PROTOCOL_RFCOMM 0x0003 +#define SDP_UUID_PROTOCOL_TCP 0x0004 +#define SDP_UUID_PROTOCOL_TCS_BIN 0x0005 +#define SDP_UUID_PROTOCOL_TCS_AT 0x0006 +#define SDP_UUID_PROTOCOL_OBEX 0x0008 +#define SDP_UUID_PROTOCOL_IP 0x0009 +#define SDP_UUID_PROTOCOL_FTP 0x000A +#define SDP_UUID_PROTOCOL_HTTP 0x000C +#define SDP_UUID_PROTOCOL_WSP 0x000E +#define SDP_UUID_PROTOCOL_BNEP 0x000F +#define SDP_UUID_PROTOCOL_UPNP 0x0010 +#define SDP_UUID_PROTOCOL_HIDP 0x0011 +#define SDP_UUID_PROTOCOL_HARDCOPY_CONTROL_CHANNEL 0x0012 +#define SDP_UUID_PROTOCOL_HARDCOPY_DATA_CHANNEL 0x0014 +#define SDP_UUID_PROTOCOL_HARDCOPY_NOTIFICATION 0x0016 +#define SDP_UUID_PROTOCOL_AVCTP 0x0017 +#define SDP_UUID_PROTOCOL_AVDTP 0x0019 +#define SDP_UUID_PROTOCOL_CMPT 0x001B +#define SDP_UUID_PROTOCOL_UDI_C_PLANE 0x001D +#define SDP_UUID_PROTOCOL_L2CAP 0x0100 + +/* + * Service class IDs http://www.bluetoothsig.org/assigned-numbers/sdp.htm + */ + +#define SDP_SERVICE_CLASS_SERVICE_DISCOVERY_SERVER 0x1000 +#define SDP_SERVICE_CLASS_BROWSE_GROUP_DESCRIPTOR 0x1001 +#define SDP_SERVICE_CLASS_PUBLIC_BROWSE_GROUP 0x1002 +#define SDP_SERVICE_CLASS_SERIAL_PORT 0x1101 +#define SDP_SERVICE_CLASS_LAN_ACCESS_USING_PPP 0x1102 +#define SDP_SERVICE_CLASS_DIALUP_NETWORKING 0x1103 +#define SDP_SERVICE_CLASS_IR_MC_SYNC 0x1104 +#define SDP_SERVICE_CLASS_OBEX_OBJECT_PUSH 0x1105 +#define SDP_SERVICE_CLASS_OBEX_FILE_TRANSFER 0x1106 +#define SDP_SERVICE_CLASS_IR_MC_SYNC_COMMAND 0x1107 +#define SDP_SERVICE_CLASS_HEADSET 0x1108 +#define SDP_SERVICE_CLASS_CORDLESS_TELEPHONY 0x1109 +#define SDP_SERVICE_CLASS_AUDIO_SOURCE 0x110A +#define SDP_SERVICE_CLASS_AUDIO_SINK 0x110B +#define SDP_SERVICE_CLASS_AV_REMOTE_CONTROL_TARGET 0x110C +#define SDP_SERVICE_CLASS_ADVANCED_AUDIO_DISTRIBUTION 0x110D +#define SDP_SERVICE_CLASS_AV_REMOTE_CONTROL 0x110E +#define SDP_SERVICE_CLASS_VIDEO_CONFERENCING 0x110F +#define SDP_SERVICE_CLASS_INTERCOM 0x1110 +#define SDP_SERVICE_CLASS_FAX 0x1111 +#define SDP_SERVICE_CLASS_HEADSET_AUDIO_GATEWAY 0x1112 +#define SDP_SERVICE_CLASS_WAP 0x1113 +#define SDP_SERVICE_CLASS_WAP_CLIENT 0x1114 +#define SDP_SERVICE_CLASS_PANU 0x1115 +#define SDP_SERVICE_CLASS_NAP 0x1116 +#define SDP_SERVICE_CLASS_GN 0x1117 +#define SDP_SERVICE_CLASS_DIRECT_PRINTING 0x1118 +#define SDP_SERVICE_CLASS_REFERENCE_PRINTING 0x1119 +#define SDP_SERVICE_CLASS_IMAGING 0x111A +#define SDP_SERVICE_CLASS_IMAGING_RESPONDER 0x111B +#define SDP_SERVICE_CLASS_IMAGING_AUTOMATIC_ARCHIVE 0x111C +#define SDP_SERVICE_CLASS_IMAGING_REFERENCED_OBJECTS 0x111D +#define SDP_SERVICE_CLASS_HANDSFREE 0x111E +#define SDP_SERVICE_CLASS_HANDSFREE_AUDIO_GATEWAY 0x111F +#define SDP_SERVICE_CLASS_DIRECT_PRINTING_REFERENCE_OBJECTS 0x1120 +#define SDP_SERVICE_CLASS_REFLECTED_UI 0x1121 +#define SDP_SERVICE_CLASS_BASIC_PRINTING 0x1122 +#define SDP_SERVICE_CLASS_PRINTING_STATUS 0x1123 +#define SDP_SERVICE_CLASS_HUMAN_INTERFACE_DEVICE 0x1124 +#define SDP_SERVICE_CLASS_HARDCOPY_CABLE_REPLACEMENT 0x1125 +#define SDP_SERVICE_CLASS_HCR_PRINT 0x1126 +#define SDP_SERVICE_CLASS_HCR_SCAN 0x1127 +#define SDP_SERVICE_CLASS_COMMON_ISDN_ACCESS 0x1128 +#define SDP_SERVICE_CLASS_VIDEO_CONFERENCING_GW 0x1129 +#define SDP_SERVICE_CLASS_UDI_MT 0x112A +#define SDP_SERVICE_CLASS_UDI_TA 0x112B +#define SDP_SERVICE_CLASS_AUDIO_VIDEO 0x112C +#define SDP_SERVICE_CLASS_SIM_ACCESS 0x112D +#define SDP_SERVICE_CLASS_PNP_INFORMATION 0x1200 +#define SDP_SERVICE_CLASS_GENERIC_NETWORKING 0x1201 +#define SDP_SERVICE_CLASS_GENERIC_FILE_TRANSFER 0x1202 +#define SDP_SERVICE_CLASS_GENERIC_AUDIO 0x1203 +#define SDP_SERVICE_CLASS_GENERIC_TELEPHONY 0x1204 +#define SDP_SERVICE_CLASS_UPNP 0x1205 +#define SDP_SERVICE_CLASS_UPNP_IP 0x1206 +#define SDP_SERVICE_CLASS_ESDP_UPNP_IP_PAN 0x1300 +#define SDP_SERVICE_CLASS_ESDP_UPNP_IP_LAP 0x1301 +#define SDP_SERVICE_CLASS_ESDP_UPNP_L2CAP 0x1302 + +/* + * Universal attribute definitions (page 366) and + * http://www.bluetoothsig.org/assigned-numbers/sdp.htm + */ + +#define SDP_ATTR_RANGE(lo, hi) \ + (uint32_t)(((uint16_t)(lo) << 16) | ((uint16_t)(hi))) + +#define SDP_ATTR_SERVICE_RECORD_HANDLE 0x0000 +#define SDP_ATTR_SERVICE_CLASS_ID_LIST 0x0001 +#define SDP_ATTR_SERVICE_RECORD_STATE 0x0002 +#define SDP_ATTR_SERVICE_ID 0x0003 +#define SDP_ATTR_PROTOCOL_DESCRIPTOR_LIST 0x0004 +#define SDP_ATTR_BROWSE_GROUP_LIST 0x0005 +#define SDP_ATTR_LANGUAGE_BASE_ATTRIBUTE_ID_LIST 0x0006 +#define SDP_ATTR_SERVICE_INFO_TIME_TO_LIVE 0x0007 +#define SDP_ATTR_SERVICE_AVAILABILITY 0x0008 +#define SDP_ATTR_BLUETOOTH_PROFILE_DESCRIPTOR_LIST 0x0009 +#define SDP_ATTR_DOCUMENTATION_URL 0x000A +#define SDP_ATTR_CLIENT_EXECUTABLE_URL 0x000B +#define SDP_ATTR_ICON_URL 0x000C +#define SDP_ATTR_ADDITIONAL_PROTOCOL_DESCRIPTOR_LISTS 0x000D +#define SDP_ATTR_GROUP_ID 0x0200 +#define SDP_ATTR_IP_SUBNET 0x0200 +#define SDP_ATTR_VERSION_NUMBER_LIST 0x0200 +#define SDP_ATTR_SERVICE_DATABASE_STATE 0x0201 +#define SDP_ATTR_SERVICE_VERSION 0x0300 +#define SDP_ATTR_EXTERNAL_NETWORK 0x0301 +#define SDP_ATTR_NETWORK 0x0301 +#define SDP_ATTR_SUPPORTED_DATA_STORES_LIST 0x0301 +#define SDP_ATTR_FAX_CLASS1_SUPPORT 0x0302 +#define SDP_ATTR_REMOTE_AUDIO_VOLUME_CONTROL 0x0302 +#define SDP_ATTR_FAX_CLASS20_SUPPORT 0x0303 +#define SDP_ATTR_SUPPORTED_FORMATS_LIST 0x0303 +#define SDP_ATTR_FAX_CLASS2_SUPPORT 0x0304 +#define SDP_ATTR_AUDIO_FEEDBACK_SUPPORT 0x0305 +#define SDP_ATTR_NETWORK_ADDRESS 0x0306 +#define SDP_ATTR_WAP_GATEWAY 0x0307 +#define SDP_ATTR_HOME_PAGE_URL 0x0308 +#define SDP_ATTR_WAP_STACK_TYPE 0x0309 +#define SDP_ATTR_SECURITY_DESCRIPTION 0x030A +#define SDP_ATTR_NET_ACCESS_TYPE 0x030B +#define SDP_ATTR_MAX_NET_ACCESS_RATE 0x030C +#define SDP_ATTR_IPV4_SUBNET 0x030D +#define SDP_ATTR_IPV6_SUBNET 0x030E +#define SDP_ATTR_SUPPORTED_CAPABALITIES 0x0310 +#define SDP_ATTR_SUPPORTED_FEATURES 0x0311 +#define SDP_ATTR_SUPPORTED_FUNCTIONS 0x0312 +#define SDP_ATTR_TOTAL_IMAGING_DATA_CAPACITY 0x0313 + +/* + * The offset must be added to the attribute ID base (contained in the + * LANGUAGE_BASE_ATTRIBUTE_ID_LIST attribute) in order to compute the + * attribute ID for these attributes. + */ + +#define SDP_ATTR_PRIMARY_LANGUAGE_BASE_ID 0x0100 +#define SDP_ATTR_SERVICE_NAME_OFFSET 0x0000 +#define SDP_ATTR_SERVICE_DESCRIPTION_OFFSET 0x0001 +#define SDP_ATTR_PROVIDER_NAME_OFFSET 0x0002 + +/* + * Protocol data unit (PDU) format (page 352) + */ + +#define SDP_PDU_ERROR_RESPONSE 0x01 +#define SDP_PDU_SERVICE_SEARCH_REQUEST 0x02 +#define SDP_PDU_SERVICE_SEARCH_RESPONSE 0x03 +#define SDP_PDU_SERVICE_ATTRIBUTE_REQUEST 0x04 +#define SDP_PDU_SERVICE_ATTRIBUTE_RESPONSE 0x05 +#define SDP_PDU_SERVICE_SEARCH_ATTRIBUTE_REQUEST 0x06 +#define SDP_PDU_SERVICE_SEARCH_ATTRIBUTE_RESPONSE 0x07 + +struct sdp_pdu { + uint8_t pid; /* PDU ID - SDP_PDU_xxx */ + uint16_t tid; /* transaction ID */ + uint16_t len; /* parameters length (in bytes) */ +} __attribute__ ((packed)); +typedef struct sdp_pdu sdp_pdu_t; +typedef struct sdp_pdu * sdp_pdu_p; + +/* + * Error codes for SDP_PDU_ERROR_RESPONSE + */ + +#define SDP_ERROR_CODE_INVALID_SDP_VERSION 0x0001 +#define SDP_ERROR_CODE_INVALID_SERVICE_RECORD_HANDLE 0x0002 +#define SDP_ERROR_CODE_INVALID_REQUEST_SYNTAX 0x0003 +#define SDP_ERROR_CODE_INVALID_PDU_SIZE 0x0004 +#define SDP_ERROR_CODE_INVALID_CONTINUATION_STATE 0x0005 +#define SDP_ERROR_CODE_INSUFFICIENT_RESOURCES 0x0006 + +/* + * SDP int128/uint128 parameter + */ + +struct int128 { + int8_t b[16]; +}; +typedef struct int128 int128_t; +typedef struct int128 uint128_t; + +/* + * SDP attribute + */ + +struct sdp_attr { + uint16_t flags; +#define SDP_ATTR_OK (0 << 0) +#define SDP_ATTR_INVALID (1 << 0) +#define SDP_ATTR_TRUNCATED (1 << 1) + uint16_t attr; /* SDP_ATTR_xxx */ + uint32_t vlen; /* length of the value[] in bytes */ + uint8_t *value; /* base pointer */ +}; +typedef struct sdp_attr sdp_attr_t; +typedef struct sdp_attr * sdp_attr_p; + +/****************************************************************************** + * User interface + *****************************************************************************/ + +/* Inline versions of get/put byte/short/long. Pointer is advanced */ +#define SDP_GET8(b, cp) { \ + register uint8_t *t_cp = (uint8_t *)(cp); \ + (b) = *t_cp; \ + (cp) ++; \ +} + +#define SDP_GET16(s, cp) { \ + register uint8_t *t_cp = (uint8_t *)(cp); \ + (s) = ((uint16_t)t_cp[0] << 8) \ + | ((uint16_t)t_cp[1]) \ + ; \ + (cp) += 2; \ +} + +#define SDP_GET32(l, cp) { \ + register uint8_t *t_cp = (uint8_t *)(cp); \ + (l) = ((uint32_t)t_cp[0] << 24) \ + | ((uint32_t)t_cp[1] << 16) \ + | ((uint32_t)t_cp[2] << 8) \ + | ((uint32_t)t_cp[3]) \ + ; \ + (cp) += 4; \ +} + +#define SDP_GET64(l, cp) { \ + register uint8_t *t_cp = (uint8_t *)(cp); \ + (l) = ((uint64_t)t_cp[0] << 56) \ + | ((uint64_t)t_cp[1] << 48) \ + | ((uint64_t)t_cp[2] << 40) \ + | ((uint64_t)t_cp[3] << 32) \ + | ((uint64_t)t_cp[4] << 24) \ + | ((uint64_t)t_cp[5] << 16) \ + | ((uint64_t)t_cp[6] << 8) \ + | ((uint64_t)t_cp[7]) \ + ; \ + (cp) += 8; \ +} + +#if BYTE_ORDER == LITTLE_ENDIAN +#define SDP_GET128(l, cp) { \ + register uint8_t *t_cp = (uint8_t *)(cp); \ + (l)->b[15] = *t_cp++; \ + (l)->b[14] = *t_cp++; \ + (l)->b[13] = *t_cp++; \ + (l)->b[12] = *t_cp++; \ + (l)->b[11] = *t_cp++; \ + (l)->b[10] = *t_cp++; \ + (l)->b[9] = *t_cp++; \ + (l)->b[8] = *t_cp++; \ + (l)->b[7] = *t_cp++; \ + (l)->b[6] = *t_cp++; \ + (l)->b[5] = *t_cp++; \ + (l)->b[4] = *t_cp++; \ + (l)->b[3] = *t_cp++; \ + (l)->b[2] = *t_cp++; \ + (l)->b[1] = *t_cp++; \ + (l)->b[0] = *t_cp++; \ + (cp) += 16; \ +} + +#define SDP_GET_UUID128(l, cp) { \ + register uint8_t *t_cp = (uint8_t *)(cp); \ + (l)->b[0] = *t_cp++; \ + (l)->b[1] = *t_cp++; \ + (l)->b[2] = *t_cp++; \ + (l)->b[3] = *t_cp++; \ + (l)->b[4] = *t_cp++; \ + (l)->b[5] = *t_cp++; \ + (l)->b[6] = *t_cp++; \ + (l)->b[7] = *t_cp++; \ + (l)->b[8] = *t_cp++; \ + (l)->b[9] = *t_cp++; \ + (l)->b[10] = *t_cp++; \ + (l)->b[11] = *t_cp++; \ + (l)->b[12] = *t_cp++; \ + (l)->b[13] = *t_cp++; \ + (l)->b[14] = *t_cp++; \ + (l)->b[15] = *t_cp++; \ + (cp) += 16; \ +} +#elif BYTE_ORDER == BIG_ENDIAN +#define SDP_GET128(l, cp) { \ + register uint8_t *t_cp = (uint8_t *)(cp); \ + (l)->b[0] = *t_cp++; \ + (l)->b[1] = *t_cp++; \ + (l)->b[2] = *t_cp++; \ + (l)->b[3] = *t_cp++; \ + (l)->b[4] = *t_cp++; \ + (l)->b[5] = *t_cp++; \ + (l)->b[6] = *t_cp++; \ + (l)->b[7] = *t_cp++; \ + (l)->b[8] = *t_cp++; \ + (l)->b[9] = *t_cp++; \ + (l)->b[10] = *t_cp++; \ + (l)->b[11] = *t_cp++; \ + (l)->b[12] = *t_cp++; \ + (l)->b[13] = *t_cp++; \ + (l)->b[14] = *t_cp++; \ + (l)->b[15] = *t_cp++; \ + (cp) += 16; \ +} + +#define SDP_GET_UUID128(l, cp) SDP_GET128(l, cp) +#else +#error "Unsupported BYTE_ORDER" +#endif /* BYTE_ORDER */ + +#define SDP_PUT8(b, cp) { \ + register uint8_t t_b = (uint8_t)(b); \ + register uint8_t *t_cp = (uint8_t *)(cp); \ + *t_cp = t_b; \ + (cp) ++; \ +} + +#define SDP_PUT16(s, cp) { \ + register uint16_t t_s = (uint16_t)(s); \ + register uint8_t *t_cp = (uint8_t *)(cp); \ + *t_cp++ = t_s >> 8; \ + *t_cp = t_s; \ + (cp) += 2; \ +} + +#define SDP_PUT32(l, cp) { \ + register uint32_t t_l = (uint32_t)(l); \ + register uint8_t *t_cp = (uint8_t *)(cp); \ + *t_cp++ = t_l >> 24; \ + *t_cp++ = t_l >> 16; \ + *t_cp++ = t_l >> 8; \ + *t_cp = t_l; \ + (cp) += 4; \ +} + +#define SDP_PUT64(l, cp) { \ + register uint64_t t_l = (uint64_t)(l); \ + register uint8_t *t_cp = (uint8_t *)(cp); \ + *t_cp++ = t_l >> 56; \ + *t_cp++ = t_l >> 48; \ + *t_cp++ = t_l >> 40; \ + *t_cp++ = t_l >> 32; \ + *t_cp++ = t_l >> 24; \ + *t_cp++ = t_l >> 16; \ + *t_cp++ = t_l >> 8; \ + *t_cp = t_l; \ + (cp) += 8; \ +} + +#if BYTE_ORDER == LITTLE_ENDIAN +#define SDP_PUT128(l, cp) { \ + register uint8_t *t_cp = (uint8_t *)(cp); \ + *t_cp++ = (l)->b[15]; \ + *t_cp++ = (l)->b[14]; \ + *t_cp++ = (l)->b[13]; \ + *t_cp++ = (l)->b[12]; \ + *t_cp++ = (l)->b[11]; \ + *t_cp++ = (l)->b[10]; \ + *t_cp++ = (l)->b[9]; \ + *t_cp++ = (l)->b[8]; \ + *t_cp++ = (l)->b[7]; \ + *t_cp++ = (l)->b[6]; \ + *t_cp++ = (l)->b[5]; \ + *t_cp++ = (l)->b[4]; \ + *t_cp++ = (l)->b[3]; \ + *t_cp++ = (l)->b[2]; \ + *t_cp++ = (l)->b[1]; \ + *t_cp = (l)->b[0]; \ + (cp) += 16; \ +} + +#define SDP_PUT_UUID128(l, cp) { \ + register uint8_t *t_cp = (uint8_t *)(cp); \ + *t_cp++ = (l)->b[0]; \ + *t_cp++ = (l)->b[1]; \ + *t_cp++ = (l)->b[2]; \ + *t_cp++ = (l)->b[3]; \ + *t_cp++ = (l)->b[4]; \ + *t_cp++ = (l)->b[5]; \ + *t_cp++ = (l)->b[6]; \ + *t_cp++ = (l)->b[7]; \ + *t_cp++ = (l)->b[8]; \ + *t_cp++ = (l)->b[9]; \ + *t_cp++ = (l)->b[10]; \ + *t_cp++ = (l)->b[11]; \ + *t_cp++ = (l)->b[12]; \ + *t_cp++ = (l)->b[13]; \ + *t_cp++ = (l)->b[14]; \ + *t_cp = (l)->b[15]; \ + (cp) += 16; \ +} +#elif BYTE_ORDER == BIG_ENDIAN +#define SDP_PUT128(l, cp) { \ + register uint8_t *t_cp = (uint8_t *)(cp); \ + *t_cp++ = (l)->b[0]; \ + *t_cp++ = (l)->b[1]; \ + *t_cp++ = (l)->b[2]; \ + *t_cp++ = (l)->b[3]; \ + *t_cp++ = (l)->b[4]; \ + *t_cp++ = (l)->b[5]; \ + *t_cp++ = (l)->b[6]; \ + *t_cp++ = (l)->b[7]; \ + *t_cp++ = (l)->b[8]; \ + *t_cp++ = (l)->b[9]; \ + *t_cp++ = (l)->b[10]; \ + *t_cp++ = (l)->b[11]; \ + *t_cp++ = (l)->b[12]; \ + *t_cp++ = (l)->b[13]; \ + *t_cp++ = (l)->b[14]; \ + *t_cp = (l)->b[15]; \ + (cp) += 16; \ +} + +#define SDP_PUT_UUID128(l, cp) SDP_PUT128(l, cp) +#else +#error "Unsupported BYTE_ORDER" +#endif /* BYTE_ORDER */ + +void * sdp_open (bdaddr_t const *l, bdaddr_t const *r); +void * sdp_open_local (char const *control); +int32_t sdp_close (void *xs); +int32_t sdp_error (void *xs); + +int32_t sdp_search (void *xs, + uint32_t plen, uint16_t const *pp, + uint32_t alen, uint32_t const *ap, + uint32_t vlen, sdp_attr_t *vp); + +char const * sdp_attr2desc (uint16_t attr); +char const * sdp_uuid2desc (uint16_t uuid); +void sdp_print (uint32_t level, uint8_t const *start, + uint8_t const *end); + +/****************************************************************************** + * sdpd interface and Bluetooth profiles data + *****************************************************************************/ + +#define SDP_LOCAL_PATH "/var/run/sdp" +#define SDP_LOCAL_MTU 4096 + +/* + * These are NOT defined in spec and only accepted on control sockets. + * The response to these request always will be SDP_PDU_ERROR_RESPONSE. + * The first 2 bytes (after PDU header) is an error code (in network + * byte order). The rest of the data (pdu->len - 2) is a response data + * and depend on the request. + * + * SDP_PDU_SERVICE_REGISTER_REQUEST + * pdu_header_t hdr; + * u_int16_t uuid; service class UUID (network byte order) + * bdaddr_t bdaddr; local BD_ADDR (or ANY) + * profile data[pdu->len - sizeof(uuid) - sizeof(bdaddr)] + * + * in successful reponse additional data will contain 4 bytes record handle + * + * + * SDP_PDU_SERVICE_UNREGISTER_REQUEST + * pdu_header_t hdr; + * u_int32_t record_handle; (network byte order) + * + * no additional data in response. + * + * + * SDP_PDU_SERVICE_CHANGE_REQUEST + * pdu_header_t hdr; + * u_int32_t record_handle; (network byte order) + * profile data[pdu->len - sizeof(record_handle)] + * + * no additional data in response. + */ + +#define SDP_PDU_SERVICE_REGISTER_REQUEST 0x81 +#define SDP_PDU_SERVICE_UNREGISTER_REQUEST 0x82 +#define SDP_PDU_SERVICE_CHANGE_REQUEST 0x83 + +struct sdp_dun_profile +{ + uint8_t server_channel; + uint8_t audio_feedback_support; + uint8_t reserved[2]; +}; +typedef struct sdp_dun_profile sdp_dun_profile_t; +typedef struct sdp_dun_profile * sdp_dun_profile_p; + +struct sdp_ftrn_profile +{ + uint8_t server_channel; + uint8_t reserved[3]; +}; +typedef struct sdp_ftrn_profile sdp_ftrn_profile_t; +typedef struct sdp_ftrn_profile * sdp_ftrn_profile_p; + +/* Keep this in sync with sdp_opush_profile */ +struct sdp_irmc_profile +{ + uint8_t server_channel; + uint8_t supported_formats_size; + uint8_t supported_formats[30]; +}; +typedef struct sdp_irmc_profile sdp_irmc_profile_t; +typedef struct sdp_irmc_profile * sdp_irmc_profile_p; + +struct sdp_irmc_command_profile +{ + uint8_t server_channel; + uint8_t reserved[3]; +}; +typedef struct sdp_irmc_command_profile sdp_irmc_command_profile_t; +typedef struct sdp_irmc_command_profile * sdp_irmc_command_profile_p; + +struct sdp_lan_profile +{ + uint8_t server_channel; + uint8_t load_factor; + uint8_t reserved; + uint8_t ip_subnet_radius; + uint32_t ip_subnet; +}; +typedef struct sdp_lan_profile sdp_lan_profile_t; +typedef struct sdp_lan_profile * sdp_lan_profile_p; + +/* Keep this in sync with sdp_irmc_profile */ +struct sdp_opush_profile +{ + uint8_t server_channel; + uint8_t supported_formats_size; + uint8_t supported_formats[30]; +}; +typedef struct sdp_opush_profile sdp_opush_profile_t; +typedef struct sdp_opush_profile * sdp_opush_profile_p; + +struct sdp_sp_profile +{ + uint8_t server_channel; + uint8_t reserved[3]; +}; +typedef struct sdp_sp_profile sdp_sp_profile_t; +typedef struct sdp_sp_profile * sdp_sp_profile_p; + +int32_t sdp_register_service (void *xss, uint16_t uuid, + bdaddr_p const bdaddr, uint8_t const *data, + uint32_t datalen, uint32_t *handle); +int32_t sdp_unregister_service (void *xss, uint32_t handle); +int32_t sdp_change_service (void *xss, uint32_t handle, + uint8_t const *data, uint32_t datalen); + +__END_DECLS + +#endif /* ndef _SDP_H_ */ + diff --git a/src/include.new/search.h b/src/include.new/search.h new file mode 100644 index 0000000..e401e01 --- /dev/null +++ b/src/include.new/search.h @@ -0,0 +1,66 @@ +/*- + * Written by J.T. Conklin + * Public domain. + * + * $NetBSD: search.h,v 1.12 1999/02/22 10:34:28 christos Exp $ + * $FreeBSD: src/include/search.h,v 1.10 2002/10/16 14:29:23 robert Exp $ + */ + +#ifndef _SEARCH_H_ +#define _SEARCH_H_ + +#include +#include + +#ifndef _SIZE_T_DECLARED +typedef __size_t size_t; +#define _SIZE_T_DECLARED +#endif + +typedef struct entry { + char *key; + void *data; +} ENTRY; + +typedef enum { + FIND, ENTER +} ACTION; + +typedef enum { + preorder, + postorder, + endorder, + leaf +} VISIT; + +#ifdef _SEARCH_PRIVATE +typedef struct node { + char *key; + struct node *llink, *rlink; +} node_t; + +struct que_elem { + struct que_elem *next; + struct que_elem *prev; +}; +#endif + +__BEGIN_DECLS +int hcreate(size_t); +void hdestroy(void); +ENTRY *hsearch(ENTRY, ACTION); +void insque(void *, void *); +void *lfind(const void *, const void *, size_t *, size_t, + int (*)(const void *, const void *)); +void *lsearch(const void *, void *, size_t *, size_t, + int (*)(const void *, const void *)); +void remque(void *); +void *tdelete(const void * __restrict, void ** __restrict, + int (*)(const void *, const void *)); +void *tfind(const void *, void * const *, + int (*)(const void *, const void *)); +void *tsearch(const void *, void **, int (*)(const void *, const void *)); +void twalk(const void *, void (*)(const void *, VISIT, int)); +__END_DECLS + +#endif /* !_SEARCH_H_ */ diff --git a/src/include.new/semaphore.h b/src/include.new/semaphore.h new file mode 100644 index 0000000..b2daf34 --- /dev/null +++ b/src/include.new/semaphore.h @@ -0,0 +1,67 @@ +/*- + * Copyright (c) 1996, 1997 + * HD Associates, Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by HD Associates, Inc + * 4. Neither the name of the author nor the names of any co-contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY HD ASSOCIATES AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL HD ASSOCIATES OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD: src/sys/posix4/semaphore.h,v 1.11 2004/02/03 22:27:03 deischen Exp $ + */ + +/* semaphore.h: POSIX 1003.1b semaphores */ + +#ifndef _SEMAPHORE_H_ +#define _SEMAPHORE_H_ + +/* Opaque type definition. */ +struct sem; +typedef struct sem * sem_t; + +#define SEM_FAILED ((sem_t *)0) +#define SEM_VALUE_MAX (~0U) /* Equivalent to UINT_MAX. */ + +#ifndef _KERNEL +#include + +struct timespec; + +__BEGIN_DECLS +int sem_close(sem_t *); +int sem_destroy(sem_t *); +int sem_getvalue(sem_t * __restrict, int * __restrict); +int sem_init(sem_t *, int, unsigned int); +sem_t *sem_open(const char *, int, ...); +int sem_post(sem_t *); +int sem_timedwait(sem_t * __restrict, const struct timespec * __restrict); +int sem_trywait(sem_t *); +int sem_unlink(const char *); +int sem_wait(sem_t *); +__END_DECLS + +#endif + +#endif /* !_SEMAPHORE_H_ */ diff --git a/src/include.new/setjmp.h b/src/include.new/setjmp.h new file mode 100644 index 0000000..eb8e630 --- /dev/null +++ b/src/include.new/setjmp.h @@ -0,0 +1,66 @@ +/*- + * Copyright (c) 1990, 1993 + * The Regents of the University of California. All rights reserved. + * (c) UNIX System Laboratories, Inc. + * All or some portions of this file are derived from material licensed + * to the University of California by American Telephone and Telegraph + * Co. or Unix System Laboratories, Inc. and are reproduced herein with + * the permission of UNIX System Laboratories, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)setjmp.h 8.2 (Berkeley) 1/21/94 + * $FreeBSD: src/include/setjmp.h,v 1.8 2002/10/05 05:48:50 mike Exp $ + */ + +#ifndef _SETJMP_H_ +#define _SETJMP_H_ + +#include + +/* The size of the jmp_buf is machine dependent: */ +#include + +__BEGIN_DECLS +#if __BSD_VISIBLE || __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE +void _longjmp(jmp_buf, int) __dead2; +int _setjmp(jmp_buf); +#endif +void longjmp(jmp_buf, int) __dead2; +#if __BSD_VISIBLE +void longjmperror(void); +#endif +int setjmp(jmp_buf); +#if __BSD_VISIBLE || __POSIX_VISIBLE || __XSI_VISIBLE +void siglongjmp(sigjmp_buf, int) __dead2; +int sigsetjmp(sigjmp_buf, int); +#endif +__END_DECLS + +#endif /* !_SETJMP_H_ */ diff --git a/src/include.new/sgtty.h b/src/include.new/sgtty.h new file mode 100644 index 0000000..723c69d --- /dev/null +++ b/src/include.new/sgtty.h @@ -0,0 +1,39 @@ +/* + * Copyright (c) 1985, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)sgtty.h 8.1 (Berkeley) 6/2/93 + */ + +#ifndef USE_OLD_TTY +#define USE_OLD_TTY +#endif +#include diff --git a/src/include.new/sha.h b/src/include.new/sha.h new file mode 100644 index 0000000..7b399e5 --- /dev/null +++ b/src/include.new/sha.h @@ -0,0 +1,98 @@ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + * + * $FreeBSD: src/lib/libmd/sha.h,v 1.4 2001/03/17 10:00:50 phk Exp $ + */ + +#ifndef _SHA_H_ +#define _SHA_H_ 1 + +#include +#include /* XXX switch to machine/ansi.h and __ types */ + +#define SHA_CBLOCK 64 +#define SHA_LBLOCK 16 +#define SHA_BLOCK 16 +#define SHA_LAST_BLOCK 56 +#define SHA_LENGTH_BLOCK 8 +#define SHA_DIGEST_LENGTH 20 + +typedef struct SHAstate_st { + u_int32_t h0, h1, h2, h3, h4; + u_int32_t Nl, Nh; + u_int32_t data[SHA_LBLOCK]; + int num; +} SHA_CTX; +#define SHA1_CTX SHA_CTX + +__BEGIN_DECLS +void SHA_Init(SHA_CTX *c); +void SHA_Update(SHA_CTX *c, const unsigned char *data, size_t len); +void SHA_Final(unsigned char *md, SHA_CTX *c); +char *SHA_End(SHA_CTX *, char *); +char *SHA_File(const char *, char *); +char *SHA_FileChunk(const char *, char *, off_t, off_t); +char *SHA_Data(const unsigned char *, unsigned int, char *); +void SHA1_Init(SHA_CTX *c); +void SHA1_Update(SHA_CTX *c, const unsigned char *data, size_t len); +void SHA1_Final(unsigned char *md, SHA_CTX *c); +char *SHA1_End(SHA_CTX *, char *); +char *SHA1_File(const char *, char *); +char *SHA1_FileChunk(const char *, char *, off_t, off_t); +char *SHA1_Data(const unsigned char *, unsigned int, char *); +__END_DECLS + +#endif /* !_SHA_H_ */ diff --git a/src/include.new/sha256.h b/src/include.new/sha256.h new file mode 100644 index 0000000..3d90b5f --- /dev/null +++ b/src/include.new/sha256.h @@ -0,0 +1,50 @@ +/*- + * Copyright 2005 Colin Percival + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD: src/lib/libmd/sha256.h,v 1.1 2005/03/09 19:23:04 cperciva Exp $ + */ + +#ifndef _SHA256_H_ +#define _SHA256_H_ + +#include + +typedef struct SHA256Context { + uint32_t state[8]; + uint32_t count[2]; + unsigned char buf[64]; +} SHA256_CTX; + +__BEGIN_DECLS +void SHA256_Init(SHA256_CTX *); +void SHA256_Update(SHA256_CTX *, const unsigned char *, size_t); +void SHA256_Final(unsigned char [32], SHA256_CTX *); +char *SHA256_End(SHA256_CTX *, char *); +char *SHA256_File(const char *, char *); +char *SHA256_FileChunk(const char *, char *, off_t, off_t); +char *SHA256_Data(const unsigned char *, unsigned int, char *); +__END_DECLS + +#endif /* !_SHA256_H_ */ diff --git a/src/include.new/signal.h b/src/include.new/signal.h new file mode 100644 index 0000000..9c8dc75 --- /dev/null +++ b/src/include.new/signal.h @@ -0,0 +1,116 @@ +/*- + * Copyright (c) 1991, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)signal.h 8.3 (Berkeley) 3/30/94 + * $FreeBSD: src/include/signal.h,v 1.24 2003/03/31 23:30:41 jeff Exp $ + */ + +#ifndef _SIGNAL_H_ +#define _SIGNAL_H_ + +#include +#include +#include + +#if __BSD_VISIBLE +/* + * XXX should enlarge these, if only to give empty names instead of bounds + * errors for large signal numbers. + */ +extern __const char *__const sys_signame[NSIG]; +extern __const char *__const sys_siglist[NSIG]; +extern __const int sys_nsig; +#endif + +#if __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE +#ifndef _PID_T_DECLARED +typedef __pid_t pid_t; +#define _PID_T_DECLARED +#endif +#endif + +__BEGIN_DECLS +int raise(int); + +#if __POSIX_VISIBLE || __XSI_VISIBLE +int kill(__pid_t, int); +int sigaction(int, const struct sigaction * __restrict, + struct sigaction * __restrict); +int sigaddset(sigset_t *, int); +int sigdelset(sigset_t *, int); +int sigemptyset(sigset_t *); +int sigfillset(sigset_t *); +int sigismember(const sigset_t *, int); +int sigpending(sigset_t *); +int sigprocmask(int, const sigset_t * __restrict, sigset_t * __restrict); +int sigsuspend(const sigset_t *); +int sigwait(const sigset_t * __restrict, int * __restrict); +#endif + +#if __POSIX_VISIBLE >= 199506 || __XSI_VISIBLE >= 600 +#if 0 +/* + * PR: 35924 + * XXX we don't actually have these. We set _POSIX_REALTIME_SIGNALS to + * -1 to show that we don't have them, but this symbol is not necessarily + * in scope (in the current implementation), so we can't use it here. + */ +int sigqueue(__pid_t, int, const union sigval); +#endif +struct timespec; +int sigtimedwait(const sigset_t * __restrict, siginfo_t * __restrict, + const struct timespec * __restrict); +int sigwaitinfo(const sigset_t * __restrict, siginfo_t * __restrict); +#endif + +#if __XSI_VISIBLE +int killpg(__pid_t, int); +int sigaltstack(const stack_t * __restrict, stack_t * __restrict); +int sigpause(int); +#endif + +#if __POSIX_VISIBLE >= 200112 +int siginterrupt(int, int); +#endif + +#if __BSD_VISIBLE +int sigblock(int); +struct __ucontext; /* XXX spec requires a complete declaration. */ +int sigreturn(const struct __ucontext *); +int sigsetmask(int); +int sigstack(const struct sigstack *, struct sigstack *); +int sigvec(int, struct sigvec *, struct sigvec *); +void psignal(unsigned int, const char *); +#endif +__END_DECLS + +#endif /* !_SIGNAL_H_ */ diff --git a/src/include.new/stab.h b/src/include.new/stab.h new file mode 100644 index 0000000..9200f52 --- /dev/null +++ b/src/include.new/stab.h @@ -0,0 +1,72 @@ +/*- + * Copyright (c) 1991, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)stab.h 8.1 (Berkeley) 6/2/93 + */ + +#ifndef _STAB_H_ +#define _STAB_H_ + +/* + * The following are symbols used by various debuggers and by the Pascal + * compiler. Each of them must have one (or more) of the bits defined by + * the N_STAB mask set. + */ + +#define N_GSYM 0x20 /* global symbol */ +#define N_FNAME 0x22 /* F77 function name */ +#define N_FUN 0x24 /* procedure name */ +#define N_STSYM 0x26 /* data segment variable */ +#define N_LCSYM 0x28 /* bss segment variable */ +#define N_MAIN 0x2a /* main function name */ +#define N_PC 0x30 /* global Pascal symbol */ +#define N_RSYM 0x40 /* register variable */ +#define N_SLINE 0x44 /* text segment line number */ +#define N_DSLINE 0x46 /* data segment line number */ +#define N_BSLINE 0x48 /* bss segment line number */ +#define N_SSYM 0x60 /* structure/union element */ +#define N_SO 0x64 /* main source file name */ +#define N_LSYM 0x80 /* stack variable */ +#define N_BINCL 0x82 /* include file beginning */ +#define N_SOL 0x84 /* included source file name */ +#define N_PSYM 0xa0 /* parameter variable */ +#define N_EINCL 0xa2 /* include file end */ +#define N_ENTRY 0xa4 /* alternate entry point */ +#define N_LBRAC 0xc0 /* left bracket */ +#define N_EXCL 0xc2 /* deleted include file */ +#define N_RBRAC 0xe0 /* right bracket */ +#define N_BCOMM 0xe2 /* begin common */ +#define N_ECOMM 0xe4 /* end common */ +#define N_ECOML 0xe8 /* end common (local name) */ +#define N_LENG 0xfe /* length of preceding entry */ + +#endif diff --git a/src/include.new/stand.h b/src/include.new/stand.h new file mode 100644 index 0000000..e6032a5 --- /dev/null +++ b/src/include.new/stand.h @@ -0,0 +1,415 @@ +/* + * Copyright (c) 1998 Michael Smith. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD: src/lib/libstand/stand.h,v 1.41 2005/05/17 17:46:29 obrien Exp $ + * From $NetBSD: stand.h,v 1.22 1997/06/26 19:17:40 drochner Exp $ + */ + +/*- + * Copyright (c) 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)stand.h 8.1 (Berkeley) 6/11/93 + */ + +#ifndef STAND_H +#define STAND_H + +#include +#include +#include +#include +#include + +#define CHK(fmt, args...) printf("%s(%d): " fmt "\n", __func__, __LINE__ , ##args) +#define PCHK(fmt, args...) {printf("%s(%d): " fmt "\n", __func__, __LINE__ , ##args); getchar();} + +#ifndef NULL +#define NULL 0 +#endif + +/* Avoid unwanted userlandish components */ +#define _KERNEL +#include +#undef _KERNEL + +/* special stand error codes */ +#define EADAPT (ELAST+1) /* bad adaptor */ +#define ECTLR (ELAST+2) /* bad controller */ +#define EUNIT (ELAST+3) /* bad unit */ +#define ESLICE (ELAST+4) /* bad slice */ +#define EPART (ELAST+5) /* bad partition */ +#define ERDLAB (ELAST+6) /* can't read disk label */ +#define EUNLAB (ELAST+7) /* unlabeled disk */ +#define EOFFSET (ELAST+8) /* relative seek not supported */ +#define ESALAST (ELAST+8) /* */ + +struct open_file; + +/* + * This structure is used to define file system operations in a file system + * independent way. + * + * XXX note that filesystem providers should export a pointer to their fs_ops + * struct, so that consumers can reference this and thus include the + * filesystems that they require. + */ +struct fs_ops { + const char *fs_name; + int (*fo_open)(const char *path, struct open_file *f); + int (*fo_close)(struct open_file *f); + int (*fo_read)(struct open_file *f, void *buf, + size_t size, size_t *resid); + int (*fo_write)(struct open_file *f, void *buf, + size_t size, size_t *resid); + off_t (*fo_seek)(struct open_file *f, off_t offset, int where); + int (*fo_stat)(struct open_file *f, struct stat *sb); + int (*fo_readdir)(struct open_file *f, struct dirent *d); +}; + +/* + * libstand-supplied filesystems + */ +extern struct fs_ops ufs_fsops; +extern struct fs_ops tftp_fsops; +extern struct fs_ops nfs_fsops; +extern struct fs_ops cd9660_fsops; +extern struct fs_ops gzipfs_fsops; +extern struct fs_ops bzipfs_fsops; +extern struct fs_ops dosfs_fsops; +extern struct fs_ops ext2fs_fsops; +extern struct fs_ops splitfs_fsops; + +/* where values for lseek(2) */ +#define SEEK_SET 0 /* set file offset to offset */ +#define SEEK_CUR 1 /* set file offset to current plus offset */ +#define SEEK_END 2 /* set file offset to EOF plus offset */ + +/* + * Device switch + */ +struct devsw { + const char dv_name[8]; + int dv_type; /* opaque type constant, arch-dependant */ + int (*dv_init)(void); /* early probe call */ + int (*dv_strategy)(void *devdata, int rw, daddr_t blk, size_t size, + char *buf, size_t *rsize); + int (*dv_open)(struct open_file *f, ...); + int (*dv_close)(struct open_file *f); + int (*dv_ioctl)(struct open_file *f, u_long cmd, void *data); + void (*dv_print)(int verbose); /* print device information */ + void (*dv_cleanup)(void); +}; + +/* + * libstand-supplied device switch + */ +extern struct devsw netdev; + +extern int errno; + +struct open_file { + int f_flags; /* see F_* below */ + struct devsw *f_dev; /* pointer to device operations */ + void *f_devdata; /* device specific data */ + struct fs_ops *f_ops; /* pointer to file system operations */ + void *f_fsdata; /* file system specific data */ + off_t f_offset; /* current file offset */ + char *f_rabuf; /* readahead buffer pointer */ + size_t f_ralen; /* valid data in readahead buffer */ + off_t f_raoffset; /* consumer offset in readahead buffer */ +#define SOPEN_RASIZE 512 +}; + +#define SOPEN_MAX 8 +extern struct open_file files[]; + +/* f_flags values */ +#define F_READ 0x0001 /* file opened for reading */ +#define F_WRITE 0x0002 /* file opened for writing */ +#define F_RAW 0x0004 /* raw device open - no file system */ +#define F_NODEV 0x0008 /* network open - no device */ + +#define isascii(c) (((c) & ~0x7F) == 0) + +static __inline int isupper(int c) +{ + return c >= 'A' && c <= 'Z'; +} + +static __inline int islower(int c) +{ + return c >= 'a' && c <= 'z'; +} + +static __inline int isspace(int c) +{ + return c == ' ' || (c >= 0x9 && c <= 0xd); +} + +static __inline int isdigit(int c) +{ + return c >= '0' && c <= '9'; +} + +static __inline int isxdigit(int c) +{ + return isdigit(c) || (c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F'); +} + +static __inline int isalpha(int c) +{ + return isupper(c) || islower(c); +} + +static __inline int isalnum(int c) +{ + return isalpha(c) || isdigit(c); +} + +static __inline int toupper(int c) +{ + return islower(c) ? c - 'a' + 'A' : c; +} + +static __inline int tolower(int c) +{ + return isupper(c) ? c - 'A' + 'a' : c; +} + +/* sbrk emulation */ +extern void setheap(void *base, void *top); +extern char *sbrk(int incr); + +/* Matt Dillon's zalloc/zmalloc */ +extern void *malloc(size_t bytes); +extern void free(void *ptr); +/*#define free(p) {CHK("free %p", p); free(p);} */ /* use for catching guard violations */ +extern void *calloc(size_t n1, size_t n2); +extern void *realloc(void *ptr, size_t size); +extern void *reallocf(void *ptr, size_t size); +extern void mallocstats(void); +#ifdef __alpha__ +extern void free_region(void *start, void *end); +#endif + +/* disklabel support (undocumented, may be junk) */ +struct disklabel; +extern char *getdisklabel(const char *, struct disklabel *); + +extern int printf(const char *fmt, ...) __printflike(1, 2); +extern void vprintf(const char *fmt, __va_list); +extern int sprintf(char *buf, const char *cfmt, ...) __printflike(2, 3); +extern void vsprintf(char *buf, const char *cfmt, __va_list); + +extern void twiddle(void); + +extern void ngets(char *, int); +#define gets(x) ngets((x), 0) +extern int fgetstr(char *buf, int size, int fd); + +extern int open(const char *, int); +#define O_RDONLY 0x0 +#define O_WRONLY 0x1 +#define O_RDWR 0x2 +extern int close(int); +extern void closeall(void); +extern ssize_t read(int, void *, size_t); +extern ssize_t write(int, void *, size_t); +extern struct dirent *readdirfd(int); + +extern void srandom(u_long seed); +extern u_long random(void); + +/* imports from stdlib, locally modified */ +extern long strtol(const char *, char **, int); +extern char *optarg; /* getopt(3) external variables */ +extern int optind, opterr, optopt, optreset; +extern int getopt(int, char * const [], const char *); + +/* pager.c */ +extern void pager_open(void); +extern void pager_close(void); +extern int pager_output(const char *lines); +extern int pager_file(const char *fname); + +/* No signal state to preserve */ +#define setjmp _setjmp +#define longjmp _longjmp + +/* environment.c */ +#define EV_DYNAMIC (1<<0) /* value was dynamically allocated, free if changed/unset */ +#define EV_VOLATILE (1<<1) /* value is volatile, make a copy of it */ +#define EV_NOHOOK (1<<2) /* don't call hook when setting */ + +struct env_var; +typedef char *(ev_format_t)(struct env_var *ev); +typedef int (ev_sethook_t)(struct env_var *ev, int flags, + const void *value); +typedef int (ev_unsethook_t)(struct env_var *ev); + +struct env_var +{ + char *ev_name; + int ev_flags; + void *ev_value; + ev_sethook_t *ev_sethook; + ev_unsethook_t *ev_unsethook; + struct env_var *ev_next, *ev_prev; +}; +extern struct env_var *environ; + +extern struct env_var *env_getenv(const char *name); +extern int env_setenv(const char *name, int flags, + const void *value, ev_sethook_t sethook, + ev_unsethook_t unsethook); +extern char *getenv(const char *name); +extern int setenv(const char *name, const char *value, + int overwrite); +extern int putenv(const char *string); +extern int unsetenv(const char *name); + +extern ev_sethook_t env_noset; /* refuse set operation */ +extern ev_unsethook_t env_nounset; /* refuse unset operation */ + +/* BCD conversions (undocumented) */ +extern u_char const bcd2bin_data[]; +extern u_char const bin2bcd_data[]; +extern char const hex2ascii_data[]; + +#define bcd2bin(bcd) (bcd2bin_data[bcd]) +#define bin2bcd(bin) (bin2bcd_data[bin]) +#define hex2ascii(hex) (hex2ascii_data[hex]) + +/* min/max (undocumented) */ +static __inline int imax(int a, int b) { return (a > b ? a : b); } +static __inline int imin(int a, int b) { return (a < b ? a : b); } +static __inline long lmax(long a, long b) { return (a > b ? a : b); } +static __inline long lmin(long a, long b) { return (a < b ? a : b); } +static __inline u_int max(u_int a, u_int b) { return (a > b ? a : b); } +static __inline u_int min(u_int a, u_int b) { return (a < b ? a : b); } +static __inline quad_t qmax(quad_t a, quad_t b) { return (a > b ? a : b); } +static __inline quad_t qmin(quad_t a, quad_t b) { return (a < b ? a : b); } +static __inline u_long ulmax(u_long a, u_long b) { return (a > b ? a : b); } +static __inline u_long ulmin(u_long a, u_long b) { return (a < b ? a : b); } + +/* swaps (undocumented, useful?) */ +#ifdef __i386__ +extern u_int32_t bswap32(u_int32_t x); +extern u_int64_t bswap64(u_int64_t x); +#endif + +/* null functions for device/filesystem switches (undocumented) */ +extern int nodev(void); +extern int noioctl(struct open_file *, u_long, void *); +extern void nullsys(void); + +extern int null_open(const char *path, struct open_file *f); +extern int null_close(struct open_file *f); +extern int null_read(struct open_file *f, void *buf, size_t size, size_t *resid); +extern int null_write(struct open_file *f, void *buf, size_t size, size_t *resid); +extern off_t null_seek(struct open_file *f, off_t offset, int where); +extern int null_stat(struct open_file *f, struct stat *sb); +extern int null_readdir(struct open_file *f, struct dirent *d); + + +/* + * Machine dependent functions and data, must be provided or stubbed by + * the consumer + */ +extern int getchar(void); +extern int ischar(void); +extern void putchar(int); +extern int devopen(struct open_file *, const char *, const char **); +extern int devclose(struct open_file *f); +extern void panic(const char *, ...) __dead2 __printflike(1, 2); +extern struct fs_ops *file_system[]; +extern struct devsw *devsw[]; + +/* + * Expose byteorder(3) functions. + */ +#ifndef _BYTEORDER_PROTOTYPED +#define _BYTEORDER_PROTOTYPED +extern uint32_t htonl(uint32_t); +extern uint16_t htons(uint16_t); +extern uint32_t ntohl(uint32_t); +extern uint16_t ntohs(uint16_t); +#endif + +#ifndef _BYTEORDER_FUNC_DEFINED +#define _BYTEORDER_FUNC_DEFINED +#define htonl(x) __htonl(x) +#define htons(x) __htons(x) +#define ntohl(x) __ntohl(x) +#define ntohs(x) __ntohs(x) +#endif + +void *Malloc(size_t, const char *, int); +void *Calloc(size_t, size_t, const char *, int); +void *Realloc(void *, size_t, const char *, int); +void Free(void *, const char *, int); + +#if 1 +#define malloc(x) Malloc(x, __FILE__, __LINE__) +#define calloc(x, y) Calloc(x, y, __FILE__, __LINE__) +#define free(x) Free(x, __FILE__, __LINE__) +#define realloc(x, y) Realloc(x, y, __FILE__, __LINE__) +#else +#define malloc(x) Malloc(x, NULL, 0) +#define calloc(x, y) Calloc(x, y, NULL, 0) +#define free(x) Free(x, NULL, 0) +#define realloc(x, y) Realloc(x, y, NULL, 0) +#endif + +#endif /* STAND_H */ diff --git a/src/include.new/stdarg.h b/src/include.new/stdarg.h new file mode 100644 index 0000000..6cf6b69 --- /dev/null +++ b/src/include.new/stdarg.h @@ -0,0 +1,90 @@ +/*- + * Copyright (c) 2002 David E. O'Brien. All rights reserved. + * Copyright (c) 1991, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)stdarg.h 8.1 (Berkeley) 6/10/93 + * $FreeBSD: src/sys/i386/include/stdarg.h,v 1.20 2005/03/02 21:33:26 joerg Exp $ + */ + +#ifndef _MACHINE_STDARG_H_ +#define _MACHINE_STDARG_H_ + +#include +#include + +#ifndef _VA_LIST_DECLARED +#define _VA_LIST_DECLARED +typedef __va_list va_list; +#endif + +#ifdef __GNUCLIKE_BUILTIN_STDARG + +#define va_start(ap, last) \ + __builtin_stdarg_start((ap), (last)) + +#define va_arg(ap, type) \ + __builtin_va_arg((ap), type) + +#if __ISO_C_VISIBLE >= 1999 +#define va_copy(dest, src) \ + __builtin_va_copy((dest), (src)) +#endif + +#define va_end(ap) \ + __builtin_va_end(ap) + +#else /* !__GNUCLIKE_BUILTIN_STDARG */ + +#define __va_size(type) \ + (((sizeof(type) + sizeof(int) - 1) / sizeof(int)) * sizeof(int)) + +#ifdef __GNUCLIKE_BUILTIN_NEXT_ARG +#define va_start(ap, last) \ + ((ap) = (va_list)__builtin_next_arg(last)) +#else /* !__GNUCLIKE_BUILTIN_NEXT_ARG */ +#define va_start(ap, last) \ + ((ap) = (va_list)&(last) + __va_size(last)) +#endif /* __GNUCLIKE_BUILTIN_NEXT_ARG */ + +#define va_arg(ap, type) \ + (*(type *)((ap) += __va_size(type), (ap) - __va_size(type))) + +#if __ISO_C_VISIBLE >= 1999 +#define va_copy(dest, src) \ + ((dest) = (src)) +#endif + +#define va_end(ap) + +#endif /* __GNUCLIKE_BUILTIN_STDARG */ + +#endif /* !_MACHINE_STDARG_H_ */ diff --git a/src/include.new/stdbool.h b/src/include.new/stdbool.h new file mode 100644 index 0000000..dc8af5b --- /dev/null +++ b/src/include.new/stdbool.h @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2000 Jeroen Ruigrok van der Werven + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD: src/include/stdbool.h,v 1.7 2005/02/19 13:47:33 marius Exp $ + */ + +#ifndef _STDBOOL_H_ +#define _STDBOOL_H_ + +#define __bool_true_false_are_defined 1 + +#ifndef __cplusplus + +#define false 0 +#define true 1 + +#define bool _Bool +#if __STDC_VERSION__ < 199901L && __GNUC__ < 3 && !defined(__INTEL_COMPILER) +typedef int _Bool; +#endif + +#endif /* !__cplusplus */ + +#endif /* !_STDBOOL_H_ */ diff --git a/src/include.new/stddef.h b/src/include.new/stddef.h new file mode 100644 index 0000000..a331305 --- /dev/null +++ b/src/include.new/stddef.h @@ -0,0 +1,68 @@ +/*- + * Copyright (c) 1990, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)stddef.h 8.1 (Berkeley) 6/2/93 + * + * $FreeBSD: src/include/stddef.h,v 1.10 2003/12/07 21:10:06 marcel Exp $ + */ + +#ifndef _STDDEF_H_ +#define _STDDEF_H_ + +#include +#include +#include + +typedef __ptrdiff_t ptrdiff_t; + +#if __BSD_VISIBLE +#ifndef _RUNE_T_DECLARED +typedef __rune_t rune_t; +#define _RUNE_T_DECLARED +#endif +#endif + +#ifndef _SIZE_T_DECLARED +typedef __size_t size_t; +#define _SIZE_T_DECLARED +#endif + +#ifndef __cplusplus +#ifndef _WCHAR_T_DECLARED +typedef __wchar_t wchar_t; +#define _WCHAR_T_DECLARED +#endif +#endif + +#define offsetof(type, member) __offsetof(type, member) + +#endif /* _STDDEF_H_ */ diff --git a/src/include.new/stdint.h b/src/include.new/stdint.h new file mode 100644 index 0000000..b0d6632 --- /dev/null +++ b/src/include.new/stdint.h @@ -0,0 +1,106 @@ +/*- + * Copyright (c) 2001 Mike Barcroft + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD: src/sys/sys/stdint.h,v 1.4 2002/08/21 16:20:01 mike Exp $ + */ + +#ifndef _SYS_STDINT_H_ +#define _SYS_STDINT_H_ + +#include +#include + +#include + +#ifndef _INT8_T_DECLARED +typedef __int8_t int8_t; +#define _INT8_T_DECLARED +#endif + +#ifndef _INT16_T_DECLARED +typedef __int16_t int16_t; +#define _INT16_T_DECLARED +#endif + +#ifndef _INT32_T_DECLARED +typedef __int32_t int32_t; +#define _INT32_T_DECLARED +#endif + +#ifndef _INT64_T_DECLARED +typedef __int64_t int64_t; +#define _INT64_T_DECLARED +#endif + +#ifndef _UINT8_T_DECLARED +typedef __uint8_t uint8_t; +#define _UINT8_T_DECLARED +#endif + +#ifndef _UINT16_T_DECLARED +typedef __uint16_t uint16_t; +#define _UINT16_T_DECLARED +#endif + +#ifndef _UINT32_T_DECLARED +typedef __uint32_t uint32_t; +#define _UINT32_T_DECLARED +#endif + +#ifndef _UINT64_T_DECLARED +typedef __uint64_t uint64_t; +#define _UINT64_T_DECLARED +#endif + +typedef __int_least8_t int_least8_t; +typedef __int_least16_t int_least16_t; +typedef __int_least32_t int_least32_t; +typedef __int_least64_t int_least64_t; + +typedef __uint_least8_t uint_least8_t; +typedef __uint_least16_t uint_least16_t; +typedef __uint_least32_t uint_least32_t; +typedef __uint_least64_t uint_least64_t; + +typedef __int_fast8_t int_fast8_t; +typedef __int_fast16_t int_fast16_t; +typedef __int_fast32_t int_fast32_t; +typedef __int_fast64_t int_fast64_t; + +typedef __uint_fast8_t uint_fast8_t; +typedef __uint_fast16_t uint_fast16_t; +typedef __uint_fast32_t uint_fast32_t; +typedef __uint_fast64_t uint_fast64_t; + +typedef __intmax_t intmax_t; +typedef __uintmax_t uintmax_t; + +#ifndef _INTPTR_T_DECLARED +typedef __intptr_t intptr_t; +typedef __uintptr_t uintptr_t; +#define _INTPTR_T_DECLARED +#endif + +#endif /* !_SYS_STDINT_H_ */ diff --git a/src/include.new/stdio.h b/src/include.new/stdio.h new file mode 100644 index 0000000..ef3f0ab --- /dev/null +++ b/src/include.new/stdio.h @@ -0,0 +1,450 @@ +/*- + * Copyright (c) 1990, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Chris Torek. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)stdio.h 8.5 (Berkeley) 4/29/95 + * $FreeBSD: src/include/stdio.h,v 1.56.8.1 2006/01/31 17:57:17 stefanf Exp $ + */ + +#ifndef _STDIO_H_ +#define _STDIO_H_ + +#include +#include +#include + +typedef __off_t fpos_t; + +#ifndef _SIZE_T_DECLARED +typedef __size_t size_t; +#define _SIZE_T_DECLARED +#endif + +#if __BSD_VISIBLE || __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE +#ifndef _VA_LIST_DECLARED +typedef __va_list va_list; +#define _VA_LIST_DECLARED +#endif +#endif + +#define _FSTDIO /* Define for new stdio with functions. */ + +/* + * NB: to fit things in six character monocase externals, the stdio + * code uses the prefix `__s' for stdio objects, typically followed + * by a three-character attempt at a mnemonic. + */ + +/* stdio buffers */ +struct __sbuf { + unsigned char *_base; + int _size; +}; + +/* hold a buncha junk that would grow the ABI */ +struct __sFILEX; + +/* + * stdio state variables. + * + * The following always hold: + * + * if (_flags&(__SLBF|__SWR)) == (__SLBF|__SWR), + * _lbfsize is -_bf._size, else _lbfsize is 0 + * if _flags&__SRD, _w is 0 + * if _flags&__SWR, _r is 0 + * + * This ensures that the getc and putc macros (or inline functions) never + * try to write or read from a file that is in `read' or `write' mode. + * (Moreover, they can, and do, automatically switch from read mode to + * write mode, and back, on "r+" and "w+" files.) + * + * _lbfsize is used only to make the inline line-buffered output stream + * code as compact as possible. + * + * _ub, _up, and _ur are used when ungetc() pushes back more characters + * than fit in the current _bf, or when ungetc() pushes back a character + * that does not match the previous one in _bf. When this happens, + * _ub._base becomes non-nil (i.e., a stream has ungetc() data iff + * _ub._base!=NULL) and _up and _ur save the current values of _p and _r. + */ +typedef struct __sFILE { + unsigned char *_p; /* current position in (some) buffer */ + int _r; /* read space left for getc() */ + int _w; /* write space left for putc() */ + short _flags; /* flags, below; this FILE is free if 0 */ + short _file; /* fileno, if Unix descriptor, else -1 */ + struct __sbuf _bf; /* the buffer (at least 1 byte, if !NULL) */ + int _lbfsize; /* 0 or -_bf._size, for inline putc */ + + /* operations */ + void *_cookie; /* cookie passed to io functions */ + int (*_close)(void *); + int (*_read)(void *, char *, int); + fpos_t (*_seek)(void *, fpos_t, int); + int (*_write)(void *, const char *, int); + + /* separate buffer for long sequences of ungetc() */ + struct __sbuf _ub; /* ungetc buffer */ + struct __sFILEX *_extra; /* additions to FILE to not break ABI */ + int _ur; /* saved _r when _r is counting ungetc data */ + + /* tricks to meet minimum requirements even when malloc() fails */ + unsigned char _ubuf[3]; /* guarantee an ungetc() buffer */ + unsigned char _nbuf[1]; /* guarantee a getc() buffer */ + + /* separate buffer for fgetln() when line crosses buffer boundary */ + struct __sbuf _lb; /* buffer for fgetln() */ + + /* Unix stdio files get aligned to block boundaries on fseek() */ + int _blksize; /* stat.st_blksize (may be != _bf._size) */ + fpos_t _offset; /* current lseek offset */ +} FILE; + +#ifndef _STDSTREAM_DECLARED +__BEGIN_DECLS +extern FILE *__stdinp; +extern FILE *__stdoutp; +extern FILE *__stderrp; +__END_DECLS +#define _STDSTREAM_DECLARED +#endif + +#define __SLBF 0x0001 /* line buffered */ +#define __SNBF 0x0002 /* unbuffered */ +#define __SRD 0x0004 /* OK to read */ +#define __SWR 0x0008 /* OK to write */ + /* RD and WR are never simultaneously asserted */ +#define __SRW 0x0010 /* open for reading & writing */ +#define __SEOF 0x0020 /* found EOF */ +#define __SERR 0x0040 /* found error */ +#define __SMBF 0x0080 /* _buf is from malloc */ +#define __SAPP 0x0100 /* fdopen()ed in append mode */ +#define __SSTR 0x0200 /* this is an sprintf/snprintf string */ +#define __SOPT 0x0400 /* do fseek() optimization */ +#define __SNPT 0x0800 /* do not do fseek() optimization */ +#define __SOFF 0x1000 /* set iff _offset is in fact correct */ +#define __SMOD 0x2000 /* true => fgetln modified _p text */ +#define __SALC 0x4000 /* allocate string space dynamically */ +#define __SIGN 0x8000 /* ignore this file in _fwalk */ + +/* + * The following three definitions are for ANSI C, which took them + * from System V, which brilliantly took internal interface macros and + * made them official arguments to setvbuf(), without renaming them. + * Hence, these ugly _IOxxx names are *supposed* to appear in user code. + * + * Although numbered as their counterparts above, the implementation + * does not rely on this. + */ +#define _IOFBF 0 /* setvbuf should set fully buffered */ +#define _IOLBF 1 /* setvbuf should set line buffered */ +#define _IONBF 2 /* setvbuf should set unbuffered */ + +#define BUFSIZ 1024 /* size of buffer used by setbuf */ +#define EOF (-1) + +/* + * FOPEN_MAX is a minimum maximum, and is the number of streams that + * stdio can provide without attempting to allocate further resources + * (which could fail). Do not use this for anything. + */ + /* must be == _POSIX_STREAM_MAX */ +#define FOPEN_MAX 20 /* must be <= OPEN_MAX */ +#define FILENAME_MAX 1024 /* must be <= PATH_MAX */ + +/* System V/ANSI C; this is the wrong way to do this, do *not* use these. */ +#if __XSI_VISIBLE +#define P_tmpdir "/var/tmp/" +#endif +#define L_tmpnam 1024 /* XXX must be == PATH_MAX */ +#define TMP_MAX 308915776 + +#ifndef SEEK_SET +#define SEEK_SET 0 /* set file offset to offset */ +#endif +#ifndef SEEK_CUR +#define SEEK_CUR 1 /* set file offset to current plus offset */ +#endif +#ifndef SEEK_END +#define SEEK_END 2 /* set file offset to EOF plus offset */ +#endif + +#define stdin __stdinp +#define stdout __stdoutp +#define stderr __stderrp + +__BEGIN_DECLS +/* + * Functions defined in ANSI C standard. + */ +void clearerr(FILE *); +int fclose(FILE *); +int feof(FILE *); +int ferror(FILE *); +int fflush(FILE *); +int fgetc(FILE *); +int fgetpos(FILE * __restrict, fpos_t * __restrict); +char *fgets(char * __restrict, int, FILE * __restrict); +FILE *fopen(const char * __restrict, const char * __restrict); +int fprintf(FILE * __restrict, const char * __restrict, ...); +int fputc(int, FILE *); +int fputs(const char * __restrict, FILE * __restrict); +size_t fread(void * __restrict, size_t, size_t, FILE * __restrict); +FILE *freopen(const char * __restrict, const char * __restrict, FILE * __restrict); +int fscanf(FILE * __restrict, const char * __restrict, ...); +int fseek(FILE *, long, int); +int fsetpos(FILE *, const fpos_t *); +long ftell(FILE *); +size_t fwrite(const void * __restrict, size_t, size_t, FILE * __restrict); +int getc(FILE *); +int getchar(void); +char *gets(char *); +void perror(const char *); +int printf(const char * __restrict, ...); +int putc(int, FILE *); +int putchar(int); +int puts(const char *); +int remove(const char *); +int rename(const char *, const char *); +void rewind(FILE *); +int scanf(const char * __restrict, ...); +void setbuf(FILE * __restrict, char * __restrict); +int setvbuf(FILE * __restrict, char * __restrict, int, size_t); +int sprintf(char * __restrict, const char * __restrict, ...); +int sscanf(const char * __restrict, const char * __restrict, ...); +FILE *tmpfile(void); +char *tmpnam(char *); +int ungetc(int, FILE *); +int vfprintf(FILE * __restrict, const char * __restrict, + __va_list); +int vprintf(const char * __restrict, __va_list); +int vsprintf(char * __restrict, const char * __restrict, + __va_list); + +#if __ISO_C_VISIBLE >= 1999 +int snprintf(char * __restrict, size_t, const char * __restrict, + ...) __printflike(3, 4); +int vfscanf(FILE * __restrict, const char * __restrict, __va_list) + __scanflike(2, 0); +int vscanf(const char * __restrict, __va_list) __scanflike(1, 0); +int vsnprintf(char * __restrict, size_t, const char * __restrict, + __va_list) __printflike(3, 0); +int vsscanf(const char * __restrict, const char * __restrict, __va_list) + __scanflike(2, 0); +#endif + +/* + * Functions defined in all versions of POSIX 1003.1. + */ +#if __BSD_VISIBLE || __POSIX_VISIBLE <= 199506 +/* size for cuserid(3); UT_NAMESIZE + 1, see */ +#define L_cuserid 17 /* legacy */ +#endif + +#if __POSIX_VISIBLE +#define L_ctermid 1024 /* size for ctermid(3); PATH_MAX */ + +char *ctermid(char *); +FILE *fdopen(int, const char *); +int fileno(FILE *); +#endif /* __POSIX_VISIBLE */ + +#if __POSIX_VISIBLE >= 199209 +int pclose(FILE *); +FILE *popen(const char *, const char *); +#endif + +#if __POSIX_VISIBLE >= 199506 +int ftrylockfile(FILE *); +void flockfile(FILE *); +void funlockfile(FILE *); + +/* + * These are normally used through macros as defined below, but POSIX + * requires functions as well. + */ +int getc_unlocked(FILE *); +int getchar_unlocked(void); +int putc_unlocked(int, FILE *); +int putchar_unlocked(int); +#endif +#if __BSD_VISIBLE +void clearerr_unlocked(FILE *); +int feof_unlocked(FILE *); +int ferror_unlocked(FILE *); +int fileno_unlocked(FILE *); +#endif + +#if __POSIX_VISIBLE >= 200112 +int fseeko(FILE *, __off_t, int); +__off_t ftello(FILE *); +#endif + +#if __BSD_VISIBLE || __XSI_VISIBLE > 0 && __XSI_VISIBLE < 600 +int getw(FILE *); +int putw(int, FILE *); +#endif /* BSD or X/Open before issue 6 */ + +#if __XSI_VISIBLE +char *tempnam(const char *, const char *); +#endif + +/* + * Routines that are purely local. + */ +#if __BSD_VISIBLE +int asprintf(char **, const char *, ...) __printflike(2, 3); +char *ctermid_r(char *); +char *fgetln(FILE *, size_t *); +__const char *fmtcheck(const char *, const char *) __format_arg(2); +int fpurge(FILE *); +void setbuffer(FILE *, char *, int); +int setlinebuf(FILE *); +int vasprintf(char **, const char *, __va_list) + __printflike(2, 0); + +/* + * The system error table contains messages for the first sys_nerr + * positive errno values. Use strerror() or strerror_r() from + * instead. + */ +extern __const int sys_nerr; +extern __const char *__const sys_errlist[]; + +/* + * Stdio function-access interface. + */ +FILE *funopen(const void *, + int (*)(void *, char *, int), + int (*)(void *, const char *, int), + fpos_t (*)(void *, fpos_t, int), + int (*)(void *)); +#define fropen(cookie, fn) funopen(cookie, fn, 0, 0, 0) +#define fwopen(cookie, fn) funopen(cookie, 0, fn, 0, 0) + +/* + * Portability hacks. See . + */ +#ifndef _FTRUNCATE_DECLARED +#define _FTRUNCATE_DECLARED +int ftruncate(int, __off_t); +#endif +#ifndef _LSEEK_DECLARED +#define _LSEEK_DECLARED +__off_t lseek(int, __off_t, int); +#endif +#ifndef _MMAP_DECLARED +#define _MMAP_DECLARED +void *mmap(void *, size_t, int, int, int, __off_t); +#endif +#ifndef _TRUNCATE_DECLARED +#define _TRUNCATE_DECLARED +int truncate(const char *, __off_t); +#endif +#endif /* __BSD_VISIBLE */ + +/* + * Functions internal to the implementation. + */ +int __srget(FILE *); +int __swbuf(int, FILE *); + +/* + * The __sfoo macros are here so that we can + * define function versions in the C library. + */ +#define __sgetc(p) (--(p)->_r < 0 ? __srget(p) : (int)(*(p)->_p++)) +#if defined(__GNUC__) && defined(__STDC__) +static __inline int __sputc(int _c, FILE *_p) { + if (--_p->_w >= 0 || (_p->_w >= _p->_lbfsize && (char)_c != '\n')) + return (*_p->_p++ = _c); + else + return (__swbuf(_c, _p)); +} +#else +/* + * This has been tuned to generate reasonable code on the vax using pcc. + */ +#define __sputc(c, p) \ + (--(p)->_w < 0 ? \ + (p)->_w >= (p)->_lbfsize ? \ + (*(p)->_p = (c)), *(p)->_p != '\n' ? \ + (int)*(p)->_p++ : \ + __swbuf('\n', p) : \ + __swbuf((int)(c), p) : \ + (*(p)->_p = (c), (int)*(p)->_p++)) +#endif + +#define __sfeof(p) (((p)->_flags & __SEOF) != 0) +#define __sferror(p) (((p)->_flags & __SERR) != 0) +#define __sclearerr(p) ((void)((p)->_flags &= ~(__SERR|__SEOF))) +#define __sfileno(p) ((p)->_file) + +extern int __isthreaded; + +#define feof(p) (!__isthreaded ? __sfeof(p) : (feof)(p)) +#define ferror(p) (!__isthreaded ? __sferror(p) : (ferror)(p)) +#define clearerr(p) (!__isthreaded ? __sclearerr(p) : (clearerr)(p)) + +#if __POSIX_VISIBLE +#define fileno(p) (!__isthreaded ? __sfileno(p) : (fileno)(p)) +#endif + +#define getc(fp) (!__isthreaded ? __sgetc(fp) : (getc)(fp)) +#define putc(x, fp) (!__isthreaded ? __sputc(x, fp) : (putc)(x, fp)) + +#define getchar() getc(stdin) +#define putchar(x) putc(x, stdout) + +#if __BSD_VISIBLE +/* + * See ISO/IEC 9945-1 ANSI/IEEE Std 1003.1 Second Edition 1996-07-12 + * B.8.2.7 for the rationale behind the *_unlocked() macros. + */ +#define feof_unlocked(p) __sfeof(p) +#define ferror_unlocked(p) __sferror(p) +#define clearerr_unlocked(p) __sclearerr(p) +#define fileno_unlocked(p) __sfileno(p) +#endif +#if __POSIX_VISIBLE >= 199506 +#define getc_unlocked(fp) __sgetc(fp) +#define putc_unlocked(x, fp) __sputc(x, fp) + +#define getchar_unlocked() getc_unlocked(stdin) +#define putchar_unlocked(x) putc_unlocked(x, stdout) +#endif + +__END_DECLS +#endif /* !_STDIO_H_ */ diff --git a/src/include.new/stdlib.h b/src/include.new/stdlib.h new file mode 100644 index 0000000..50b9ccc --- /dev/null +++ b/src/include.new/stdlib.h @@ -0,0 +1,286 @@ +/*- + * Copyright (c) 1990, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)stdlib.h 8.5 (Berkeley) 5/19/95 + * $FreeBSD: src/include/stdlib.h,v 1.57.2.2 2006/04/04 19:56:46 andre Exp $ + */ + +#ifndef _STDLIB_H_ +#define _STDLIB_H_ + +#include +#include +#include + +#if __BSD_VISIBLE +#ifndef _RUNE_T_DECLARED +typedef __rune_t rune_t; +#define _RUNE_T_DECLARED +#endif +#endif + +#ifndef _SIZE_T_DECLARED +typedef __size_t size_t; +#define _SIZE_T_DECLARED +#endif + +#ifndef __cplusplus +#ifndef _WCHAR_T_DECLARED +typedef __wchar_t wchar_t; +#define _WCHAR_T_DECLARED +#endif +#endif + +typedef struct { + int quot; /* quotient */ + int rem; /* remainder */ +} div_t; + +typedef struct { + long quot; + long rem; +} ldiv_t; + +#define EXIT_FAILURE 1 +#define EXIT_SUCCESS 0 + +#define RAND_MAX 0x7fffffff + +extern int __mb_cur_max; +#define MB_CUR_MAX __mb_cur_max + +__BEGIN_DECLS +void abort(void) __dead2; +int abs(int) __pure2; +int atexit(void (*)(void)); +double atof(const char *); +int atoi(const char *); +long atol(const char *); +void *bsearch(const void *, const void *, size_t, + size_t, int (*)(const void *, const void *)); +void *calloc(size_t, size_t); +div_t div(int, int) __pure2; +void exit(int) __dead2; +void free(void *); +char *getenv(const char *); +long labs(long) __pure2; +ldiv_t ldiv(long, long) __pure2; +void *malloc(size_t); +int mblen(const char *, size_t); +size_t mbstowcs(wchar_t * __restrict , const char * __restrict, size_t); +int mbtowc(wchar_t * __restrict, const char * __restrict, size_t); +void qsort(void *, size_t, size_t, + int (*)(const void *, const void *)); +int rand(void); +void *realloc(void *, size_t); +void srand(unsigned); +double strtod(const char * __restrict, char ** __restrict); +float strtof(const char * __restrict, char ** __restrict); +long strtol(const char * __restrict, char ** __restrict, int); +long double + strtold(const char * __restrict, char ** __restrict); +unsigned long + strtoul(const char * __restrict, char ** __restrict, int); +int system(const char *); +int wctomb(char *, wchar_t); +size_t wcstombs(char * __restrict, const wchar_t * __restrict, size_t); + +/* + * Functions added in C99 which we make conditionally available in the + * BSD^C89 namespace if the compiler supports `long long'. + * The #if test is more complicated than it ought to be because + * __BSD_VISIBLE implies __ISO_C_VISIBLE == 1999 *even if* `long long' + * is not supported in the compilation environment (which therefore means + * that it can't really be ISO C99). + * + * (The only other extension made by C99 in thie header is _Exit().) + */ +#if __ISO_C_VISIBLE >= 1999 +#ifdef __LONG_LONG_SUPPORTED +/* LONGLONG */ +typedef struct { + long long quot; + long long rem; +} lldiv_t; + +/* LONGLONG */ +long long + atoll(const char *); +/* LONGLONG */ +long long + llabs(long long) __pure2; +/* LONGLONG */ +lldiv_t lldiv(long long, long long) __pure2; +/* LONGLONG */ +long long + strtoll(const char * __restrict, char ** __restrict, int); +/* LONGLONG */ +unsigned long long + strtoull(const char * __restrict, char ** __restrict, int); +#endif /* __LONG_LONG_SUPPORTED */ + +void _Exit(int) __dead2; +#endif /* __ISO_C_VISIBLE >= 1999 */ + +/* + * Extensions made by POSIX relative to C. We don't know yet which edition + * of POSIX made these extensions, so assume they've always been there until + * research can be done. + */ +#if __POSIX_VISIBLE /* >= ??? */ +/* int posix_memalign(void **, size_t, size_t); (ADV) */ +int rand_r(unsigned *); /* (TSF) */ +int setenv(const char *, const char *, int); +void unsetenv(const char *); +#endif + +/* + * The only changes to the XSI namespace in revision 6 were the deletion + * of the ttyslot() and valloc() functions, which FreeBSD never declared + * in this header. For revision 7, ecvt(), fcvt(), and gcvt(), which + * FreeBSD also does not have, and mktemp(), are to be deleted. + */ +#if __XSI_VISIBLE +/* XXX XSI requires pollution from here. We'd rather not. */ +long a64l(const char *); +double drand48(void); +/* char *ecvt(double, int, int * __restrict, int * __restrict); */ +double erand48(unsigned short[3]); +/* char *fcvt(double, int, int * __restrict, int * __restrict); */ +/* char *gcvt(double, int, int * __restrict, int * __restrict); */ +int getsubopt(char **, char *const *, char **); +int grantpt(int); +char *initstate(unsigned long /* XSI requires u_int */, char *, long); +long jrand48(unsigned short[3]); +char *l64a(long); +void lcong48(unsigned short[7]); +long lrand48(void); +#ifndef _MKSTEMP_DECLARED +int mkstemp(char *); +#define _MKSTEMP_DECLARED +#endif +#ifndef _MKTEMP_DECLARED +char *mktemp(char *); +#define _MKTEMP_DECLARED +#endif +long mrand48(void); +long nrand48(unsigned short[3]); +int posix_openpt(int); +char *ptsname(int); +int putenv(const char *); +long random(void); +char *realpath(const char *, char resolved_path[]); +unsigned short + *seed48(unsigned short[3]); +#ifndef _SETKEY_DECLARED +int setkey(const char *); +#define _SETKEY_DECLARED +#endif +char *setstate(/* const */ char *); +void srand48(long); +void srandom(unsigned long); +int unlockpt(int); +#endif /* __XSI_VISIBLE */ + +#if __BSD_VISIBLE +extern const char *_malloc_options; +extern void (*_malloc_message)(const char *, const char *, const char *, + const char *); + +/* + * The alloca() function can't be implemented in C, and on some + * platforms it can't be implemented at all as a callable function. + * The GNU C compiler provides a built-in alloca() which we can use; + * in all other cases, provide a prototype, mainly to pacify various + * incarnations of lint. On platforms where alloca() is not in libc, + * programs which use it will fail to link when compiled with non-GNU + * compilers. + */ +#if __GNUC__ >= 2 || defined(__INTEL_COMPILER) +#undef alloca /* some GNU bits try to get cute and define this on their own */ +#define alloca(sz) __builtin_alloca(sz) +#elif defined(lint) +void *alloca(size_t); +#endif + +__uint32_t + arc4random(void); +void arc4random_addrandom(unsigned char *dat, int datlen); +void arc4random_stir(void); +char *getbsize(int *, long *); + /* getcap(3) functions */ +char *cgetcap(char *, const char *, int); +int cgetclose(void); +int cgetent(char **, char **, const char *); +int cgetfirst(char **, char **); +int cgetmatch(const char *, const char *); +int cgetnext(char **, char **); +int cgetnum(char *, const char *, long *); +int cgetset(const char *); +int cgetstr(char *, const char *, char **); +int cgetustr(char *, const char *, char **); + +int daemon(int, int); +char *devname(int, int); +char *devname_r(int, int, char *, int); +int getloadavg(double [], int); +__const char * + getprogname(void); + +int heapsort(void *, size_t, size_t, int (*)(const void *, const void *)); +int l64a_r(long, char *, int); +int mergesort(void *, size_t, size_t, int (*)(const void *, const void *)); +void qsort_r(void *, size_t, size_t, void *, + int (*)(void *, const void *, const void *)); +int radixsort(const unsigned char **, int, const unsigned char *, + unsigned); +void *reallocf(void *, size_t); +int rpmatch(const char *); +void setprogname(const char *); +int sradixsort(const unsigned char **, int, const unsigned char *, + unsigned); +void sranddev(void); +void srandomdev(void); +long long + strtonum(const char *, long long, long long, const char **); + +/* Deprecated interfaces, to be removed in FreeBSD 6.0. */ +__int64_t + strtoq(const char *, char **, int); +__uint64_t + strtouq(const char *, char **, int); + +extern char *suboptarg; /* getsubopt(3) external variable */ +#endif /* __BSD_VISIBLE */ +__END_DECLS + +#endif /* !_STDLIB_H_ */ diff --git a/src/include.new/string.h b/src/include.new/string.h new file mode 100644 index 0000000..27f522f --- /dev/null +++ b/src/include.new/string.h @@ -0,0 +1,129 @@ +/*- + * Copyright (c) 1990, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)string.h 8.1 (Berkeley) 6/2/93 + * $FreeBSD: src/include/string.h,v 1.21.2.1 2005/08/29 18:46:39 andre Exp $ + */ + +#ifndef _STRING_H_ +#define _STRING_H_ + +#include +#include +#include + +/* + * Prototype functions which were historically defined in , but + * are required by POSIX to be prototyped in . + */ +#if __BSD_VISIBLE +#include +#endif + +#ifndef _SIZE_T_DECLARED +typedef __size_t size_t; +#define _SIZE_T_DECLARED +#endif + +__BEGIN_DECLS +#if __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE +void *memccpy(void * __restrict, const void * __restrict, int, size_t); +#endif +void *memchr(const void *, int, size_t) __pure; +int memcmp(const void *, const void *, size_t) __pure; +void *memcpy(void * __restrict, const void * __restrict, size_t); +#if __BSD_VISIBLE +void *memmem(const void *, size_t, const void *, size_t); +#endif +void *memmove(void *, const void *, size_t); +void *memset(void *, int, size_t); +#if __BSD_VISIBLE +char *stpcpy(char *, const char *); +char *strcasestr(const char *, const char *) __pure; +#endif +char *strcat(char * __restrict, const char * __restrict); +char *strchr(const char *, int) __pure; +int strcmp(const char *, const char *) __pure; +int strcoll(const char *, const char *); +char *strcpy(char * __restrict, const char * __restrict); +size_t strcspn(const char *, const char *) __pure; +#if __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE +char *strdup(const char *); +#endif +char *strerror(int); +#if __POSIX_VISIBLE >= 200112 +int strerror_r(int, char *, size_t); +#endif +#if __BSD_VISIBLE +size_t strlcat(char *, const char *, size_t); +size_t strlcpy(char *, const char *, size_t); +#endif +size_t strlen(const char *) __pure; +#if __BSD_VISIBLE +void strmode(int, char *); +#endif +char *strncat(char * __restrict, const char * __restrict, size_t); +int strncmp(const char *, const char *, size_t) __pure; +char *strncpy(char * __restrict, const char * __restrict, size_t); +#if __BSD_VISIBLE +char *strnstr(const char *, const char *, size_t) __pure; +#endif +char *strpbrk(const char *, const char *) __pure; +char *strrchr(const char *, int) __pure; +#if __BSD_VISIBLE +char *strsep(char **, const char *); +char *strsignal(int); +#endif +size_t strspn(const char *, const char *) __pure; +char *strstr(const char *, const char *) __pure; +char *strtok(char * __restrict, const char * __restrict); +#if __POSIX_VISIBLE >= 199506 || __XSI_VISIBLE >= 500 +char *strtok_r(char *, const char *, char **); +#endif +size_t strxfrm(char * __restrict, const char * __restrict, size_t); +#if __BSD_VISIBLE + +#ifndef _SWAB_DECLARED +#define _SWAB_DECLARED + +#ifndef _SSIZE_T_DECLARED +typedef __ssize_t ssize_t; +#define _SSIZE_T_DECLARED +#endif /* _SIZE_T_DECLARED */ + +void swab(const void * __restrict, void * __restrict, ssize_t); +#endif /* _SWAB_DECLARED */ + +#endif /* __BSD_VISIBLE */ +__END_DECLS + +#endif /* _STRING_H_ */ diff --git a/src/include.new/stringlist.h b/src/include.new/stringlist.h new file mode 100644 index 0000000..52a121c --- /dev/null +++ b/src/include.new/stringlist.h @@ -0,0 +1,57 @@ +/* $NetBSD: stringlist.h,v 1.2 1997/01/17 06:11:36 lukem Exp $ */ + +/* + * Copyright (c) 1994 Christos Zoulas + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Christos Zoulas. + * 4. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD: src/include/stringlist.h,v 1.3 2003/01/19 01:16:00 obrien Exp $ + */ + +#ifndef _STRINGLIST_H +#define _STRINGLIST_H +#include +#include + +/* + * Simple string list + */ +typedef struct _stringlist { + char **sl_str; + size_t sl_max; + size_t sl_cur; +} StringList; + +__BEGIN_DECLS +StringList *sl_init(void); +int sl_add(StringList *, char *); +void sl_free(StringList *, int); +char *sl_find(StringList *, char *); +__END_DECLS + +#endif /* _STRINGLIST_H */ diff --git a/src/include.new/strings.h b/src/include.new/strings.h new file mode 100644 index 0000000..a7f289f --- /dev/null +++ b/src/include.new/strings.h @@ -0,0 +1,56 @@ +/*- + * Copyright (c) 2002 Mike Barcroft + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD: src/include/strings.h,v 1.6 2004/07/23 07:13:35 tjr Exp $ + */ + +#ifndef _STRINGS_H_ +#define _STRINGS_H_ + +#include +#include + +#ifndef _SIZE_T_DECLARED +typedef __size_t size_t; +#define _SIZE_T_DECLARED +#endif + +__BEGIN_DECLS +int bcmp(const void *, const void *, size_t) __pure; /* LEGACY */ +void bcopy(const void *, void *, size_t); /* LEGACY */ +void bzero(void *, size_t); /* LEGACY */ +int ffs(int) __pure2; +#ifdef __BSD_VISIBLE +int ffsl(long) __pure2; +int fls(int) __pure2; +int flsl(long) __pure2; +#endif +char *index(const char *, int) __pure; /* LEGACY */ +char *rindex(const char *, int) __pure; /* LEGACY */ +int strcasecmp(const char *, const char *) __pure; +int strncasecmp(const char *, const char *, size_t) __pure; +__END_DECLS + +#endif /* _STRINGS_H_ */ diff --git a/src/include.new/sysexits.h b/src/include.new/sysexits.h new file mode 100644 index 0000000..464cb11 --- /dev/null +++ b/src/include.new/sysexits.h @@ -0,0 +1,118 @@ +/* + * Copyright (c) 1987, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)sysexits.h 8.1 (Berkeley) 6/2/93 + */ + +#ifndef _SYSEXITS_H_ +#define _SYSEXITS_H_ + +/* + * SYSEXITS.H -- Exit status codes for system programs. + * + * This include file attempts to categorize possible error + * exit statuses for system programs, notably delivermail + * and the Berkeley network. + * + * Error numbers begin at EX__BASE to reduce the possibility of + * clashing with other exit statuses that random programs may + * already return. The meaning of the codes is approximately + * as follows: + * + * EX_USAGE -- The command was used incorrectly, e.g., with + * the wrong number of arguments, a bad flag, a bad + * syntax in a parameter, or whatever. + * EX_DATAERR -- The input data was incorrect in some way. + * This should only be used for user's data & not + * system files. + * EX_NOINPUT -- An input file (not a system file) did not + * exist or was not readable. This could also include + * errors like "No message" to a mailer (if it cared + * to catch it). + * EX_NOUSER -- The user specified did not exist. This might + * be used for mail addresses or remote logins. + * EX_NOHOST -- The host specified did not exist. This is used + * in mail addresses or network requests. + * EX_UNAVAILABLE -- A service is unavailable. This can occur + * if a support program or file does not exist. This + * can also be used as a catchall message when something + * you wanted to do doesn't work, but you don't know + * why. + * EX_SOFTWARE -- An internal software error has been detected. + * This should be limited to non-operating system related + * errors as possible. + * EX_OSERR -- An operating system error has been detected. + * This is intended to be used for such things as "cannot + * fork", "cannot create pipe", or the like. It includes + * things like getuid returning a user that does not + * exist in the passwd file. + * EX_OSFILE -- Some system file (e.g., /etc/passwd, /etc/utmp, + * etc.) does not exist, cannot be opened, or has some + * sort of error (e.g., syntax error). + * EX_CANTCREAT -- A (user specified) output file cannot be + * created. + * EX_IOERR -- An error occurred while doing I/O on some file. + * EX_TEMPFAIL -- temporary failure, indicating something that + * is not really an error. In sendmail, this means + * that a mailer (e.g.) could not create a connection, + * and the request should be reattempted later. + * EX_PROTOCOL -- the remote system returned something that + * was "not possible" during a protocol exchange. + * EX_NOPERM -- You did not have sufficient permission to + * perform the operation. This is not intended for + * file system problems, which should use NOINPUT or + * CANTCREAT, but rather for higher level permissions. + */ + +#define EX_OK 0 /* successful termination */ + +#define EX__BASE 64 /* base value for error messages */ + +#define EX_USAGE 64 /* command line usage error */ +#define EX_DATAERR 65 /* data format error */ +#define EX_NOINPUT 66 /* cannot open input */ +#define EX_NOUSER 67 /* addressee unknown */ +#define EX_NOHOST 68 /* host name unknown */ +#define EX_UNAVAILABLE 69 /* service unavailable */ +#define EX_SOFTWARE 70 /* internal software error */ +#define EX_OSERR 71 /* system error (e.g., can't fork) */ +#define EX_OSFILE 72 /* critical OS file missing */ +#define EX_CANTCREAT 73 /* can't create (user) output file */ +#define EX_IOERR 74 /* input/output error */ +#define EX_TEMPFAIL 75 /* temp failure; user is invited to retry */ +#define EX_PROTOCOL 76 /* remote error in protocol */ +#define EX_NOPERM 77 /* permission denied */ +#define EX_CONFIG 78 /* configuration error */ + +#define EX__MAX 78 /* maximum listed value */ + +#endif /* !_SYSEXITS_H_ */ diff --git a/src/include.new/syslog.h b/src/include.new/syslog.h new file mode 100644 index 0000000..9143341 --- /dev/null +++ b/src/include.new/syslog.h @@ -0,0 +1,201 @@ +/*- + * Copyright (c) 1982, 1986, 1988, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)syslog.h 8.1 (Berkeley) 6/2/93 + * $FreeBSD: src/sys/sys/syslog.h,v 1.26 2005/01/07 02:29:24 imp Exp $ + */ + +#ifndef _SYS_SYSLOG_H_ +#define _SYS_SYSLOG_H_ + +#define _PATH_LOG "/var/run/log" +#define _PATH_LOG_PRIV "/var/run/logpriv" +#define _PATH_OLDLOG "/dev/log" /* backward compatibility */ + +/* + * priorities/facilities are encoded into a single 32-bit quantity, where the + * bottom 3 bits are the priority (0-7) and the top 28 bits are the facility + * (0-big number). Both the priorities and the facilities map roughly + * one-to-one to strings in the syslogd(8) source code. This mapping is + * included in this file. + * + * priorities (these are ordered) + */ +#define LOG_EMERG 0 /* system is unusable */ +#define LOG_ALERT 1 /* action must be taken immediately */ +#define LOG_CRIT 2 /* critical conditions */ +#define LOG_ERR 3 /* error conditions */ +#define LOG_WARNING 4 /* warning conditions */ +#define LOG_NOTICE 5 /* normal but significant condition */ +#define LOG_INFO 6 /* informational */ +#define LOG_DEBUG 7 /* debug-level messages */ + +#define LOG_PRIMASK 0x07 /* mask to extract priority part (internal) */ + /* extract priority */ +#define LOG_PRI(p) ((p) & LOG_PRIMASK) +#define LOG_MAKEPRI(fac, pri) ((fac) | (pri)) + +#ifdef SYSLOG_NAMES +#define INTERNAL_NOPRI 0x10 /* the "no priority" priority */ + /* mark "facility" */ +#define INTERNAL_MARK LOG_MAKEPRI((LOG_NFACILITIES<<3), 0) +typedef struct _code { + const char *c_name; + int c_val; +} CODE; + +CODE prioritynames[] = { + { "alert", LOG_ALERT, }, + { "crit", LOG_CRIT, }, + { "debug", LOG_DEBUG, }, + { "emerg", LOG_EMERG, }, + { "err", LOG_ERR, }, + { "error", LOG_ERR, }, /* DEPRECATED */ + { "info", LOG_INFO, }, + { "none", INTERNAL_NOPRI, }, /* INTERNAL */ + { "notice", LOG_NOTICE, }, + { "panic", LOG_EMERG, }, /* DEPRECATED */ + { "warn", LOG_WARNING, }, /* DEPRECATED */ + { "warning", LOG_WARNING, }, + { NULL, -1, } +}; +#endif + +/* facility codes */ +#define LOG_KERN (0<<3) /* kernel messages */ +#define LOG_USER (1<<3) /* random user-level messages */ +#define LOG_MAIL (2<<3) /* mail system */ +#define LOG_DAEMON (3<<3) /* system daemons */ +#define LOG_AUTH (4<<3) /* authorization messages */ +#define LOG_SYSLOG (5<<3) /* messages generated internally by syslogd */ +#define LOG_LPR (6<<3) /* line printer subsystem */ +#define LOG_NEWS (7<<3) /* network news subsystem */ +#define LOG_UUCP (8<<3) /* UUCP subsystem */ +#define LOG_CRON (9<<3) /* clock daemon */ +#define LOG_AUTHPRIV (10<<3) /* authorization messages (private) */ + /* Facility #10 clashes in DEC UNIX, where */ + /* it's defined as LOG_MEGASAFE for AdvFS */ + /* event logging. */ +#define LOG_FTP (11<<3) /* ftp daemon */ +#define LOG_NTP (12<<3) /* NTP subsystem */ +#define LOG_SECURITY (13<<3) /* security subsystems (firewalling, etc.) */ +#define LOG_CONSOLE (14<<3) /* /dev/console output */ + + /* other codes through 15 reserved for system use */ +#define LOG_LOCAL0 (16<<3) /* reserved for local use */ +#define LOG_LOCAL1 (17<<3) /* reserved for local use */ +#define LOG_LOCAL2 (18<<3) /* reserved for local use */ +#define LOG_LOCAL3 (19<<3) /* reserved for local use */ +#define LOG_LOCAL4 (20<<3) /* reserved for local use */ +#define LOG_LOCAL5 (21<<3) /* reserved for local use */ +#define LOG_LOCAL6 (22<<3) /* reserved for local use */ +#define LOG_LOCAL7 (23<<3) /* reserved for local use */ + +#define LOG_NFACILITIES 24 /* current number of facilities */ +#define LOG_FACMASK 0x03f8 /* mask to extract facility part */ + /* facility of pri */ +#define LOG_FAC(p) (((p) & LOG_FACMASK) >> 3) + +#ifdef SYSLOG_NAMES +CODE facilitynames[] = { + { "auth", LOG_AUTH, }, + { "authpriv", LOG_AUTHPRIV, }, + { "console", LOG_CONSOLE, }, + { "cron", LOG_CRON, }, + { "daemon", LOG_DAEMON, }, + { "ftp", LOG_FTP, }, + { "kern", LOG_KERN, }, + { "lpr", LOG_LPR, }, + { "mail", LOG_MAIL, }, + { "mark", INTERNAL_MARK, }, /* INTERNAL */ + { "news", LOG_NEWS, }, + { "ntp", LOG_NTP, }, + { "security", LOG_SECURITY, }, + { "syslog", LOG_SYSLOG, }, + { "user", LOG_USER, }, + { "uucp", LOG_UUCP, }, + { "local0", LOG_LOCAL0, }, + { "local1", LOG_LOCAL1, }, + { "local2", LOG_LOCAL2, }, + { "local3", LOG_LOCAL3, }, + { "local4", LOG_LOCAL4, }, + { "local5", LOG_LOCAL5, }, + { "local6", LOG_LOCAL6, }, + { "local7", LOG_LOCAL7, }, + { NULL, -1, } +}; +#endif + +#ifdef _KERNEL +#define LOG_PRINTF -1 /* pseudo-priority to indicate use of printf */ +#endif + +/* + * arguments to setlogmask. + */ +#define LOG_MASK(pri) (1 << (pri)) /* mask for one priority */ +#define LOG_UPTO(pri) ((1 << ((pri)+1)) - 1) /* all priorities through pri */ + +/* + * Option flags for openlog. + * + * LOG_ODELAY no longer does anything. + * LOG_NDELAY is the inverse of what it used to be. + */ +#define LOG_PID 0x01 /* log the pid with each message */ +#define LOG_CONS 0x02 /* log on the console if errors in sending */ +#define LOG_ODELAY 0x04 /* delay open until first syslog() (default) */ +#define LOG_NDELAY 0x08 /* don't delay open */ +#define LOG_NOWAIT 0x10 /* don't wait for console forks: DEPRECATED */ +#define LOG_PERROR 0x20 /* log to stderr as well */ + +#ifdef _KERNEL + +#else /* not _KERNEL */ + +/* + * Don't use va_list in the vsyslog() prototype. Va_list is typedef'd in two + * places ( and ), so if we include one + * of them here we may collide with the utility's includes. It's unreasonable + * for utilities to have to include one of them to include syslog.h, so we get + * __va_list from and use it. + */ +#include +#include + +__BEGIN_DECLS +void closelog(void); +void openlog(const char *, int, int); +int setlogmask(int); +void syslog(int, const char *, ...) __printflike(2, 3); +void vsyslog(int, const char *, __va_list) __printflike(2, 0); +__END_DECLS + +#endif /* !_KERNEL */ + +#endif diff --git a/src/include.new/taclib.h b/src/include.new/taclib.h new file mode 100644 index 0000000..53d9c10 --- /dev/null +++ b/src/include.new/taclib.h @@ -0,0 +1,132 @@ +/*- + * Copyright (c) 1998, 2001, Juniper Networks, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD: src/lib/libtacplus/taclib.h,v 1.2 2002/09/25 23:18:51 pst Exp $ + */ + +#ifndef _TACLIB_H_ +#define _TACLIB_H_ + +#include + +struct tac_handle; + +/* Flags for tac_add_server(). */ +#define TAC_SRVR_SINGLE_CONNECT 0x04 /* Keep connection open for multiple + sessions. */ + +/* Disassembly of tac_send_authen() return value. */ +#define TAC_AUTHEN_STATUS(s) ((s) & 0xff) +#define TAC_AUTHEN_NOECHO(s) ((s) & (1<<8)) + +/* Disassembly of tac_send_author() return value. */ +#define TAC_AUTHOR_STATUS(s) ((s) & 0xff) +#define TAC_AUTHEN_AV_COUNT(s) (((s)>>8) & 0xff) + +/* Privilege levels */ +#define TAC_PRIV_LVL_MIN 0x00 +#define TAC_PRIV_LVL_USER 0x01 +#define TAC_PRIV_LVL_ROOT 0x0f +#define TAC_PRIV_LVL_MAX 0x0f + +/* Authentication actions */ +#define TAC_AUTHEN_LOGIN 0x01 +#define TAC_AUTHEN_CHPASS 0x02 +#define TAC_AUTHEN_SENDPASS 0x03 +#define TAC_AUTHEN_SENDAUTH 0x04 + +/* Authentication types */ +#define TAC_AUTHEN_TYPE_ASCII 0x01 +#define TAC_AUTHEN_TYPE_PAP 0x02 +#define TAC_AUTHEN_TYPE_CHAP 0x03 +#define TAC_AUTHEN_TYPE_ARAP 0x04 +#define TAC_AUTHEN_TYPE_MSCHAP 0x05 + +/* Authentication services */ +#define TAC_AUTHEN_SVC_NONE 0x00 +#define TAC_AUTHEN_SVC_LOGIN 0x01 +#define TAC_AUTHEN_SVC_ENABLE 0x02 +#define TAC_AUTHEN_SVC_PPP 0x03 +#define TAC_AUTHEN_SVC_ARAP 0x04 +#define TAC_AUTHEN_SVC_PT 0x05 +#define TAC_AUTHEN_SVC_RCMD 0x06 +#define TAC_AUTHEN_SVC_X25 0x07 +#define TAC_AUTHEN_SVC_NASI 0x08 +#define TAC_AUTHEN_SVC_FWPROXY 0x09 + +/* Authentication reply status codes */ +#define TAC_AUTHEN_STATUS_PASS 0x01 +#define TAC_AUTHEN_STATUS_FAIL 0x02 +#define TAC_AUTHEN_STATUS_GETDATA 0x03 +#define TAC_AUTHEN_STATUS_GETUSER 0x04 +#define TAC_AUTHEN_STATUS_GETPASS 0x05 +#define TAC_AUTHEN_STATUS_RESTART 0x06 +#define TAC_AUTHEN_STATUS_ERROR 0x07 +#define TAC_AUTHEN_STATUS_FOLLOW 0x21 + +/* Authorization authenticatication methods */ +#define TAC_AUTHEN_METH_NOT_SET 0x00 +#define TAC_AUTHEN_METH_NONE 0x01 +#define TAC_AUTHEN_METH_KRB5 0x02 +#define TAC_AUTHEN_METH_LINE 0x03 +#define TAC_AUTHEN_METH_ENABLE 0x04 +#define TAC_AUTHEN_METH_LOCAL 0x05 +#define TAC_AUTHEN_METH_TACACSPLUS 0x06 +#define TAC_AUTHEN_METH_RCMD 0x20 +/* If adding more, see comments in protocol_version() in taclib.c */ + +/* Authorization status */ +#define TAC_AUTHOR_STATUS_PASS_ADD 0x01 +#define TAC_AUTHOR_STATUS_PASS_REPL 0x02 +#define TAC_AUTHOR_STATUS_FAIL 0x10 +#define TAC_AUTHOR_STATUS_ERROR 0x11 + +__BEGIN_DECLS +int tac_add_server(struct tac_handle *, + const char *, int, const char *, int, int); +void tac_close(struct tac_handle *); +int tac_config(struct tac_handle *, const char *); +int tac_create_authen(struct tac_handle *, int, int, int); +void *tac_get_data(struct tac_handle *, size_t *); +char *tac_get_msg(struct tac_handle *); +struct tac_handle *tac_open(void); +int tac_send_authen(struct tac_handle *); +int tac_set_data(struct tac_handle *, + const void *, size_t); +int tac_set_msg(struct tac_handle *, const char *); +int tac_set_port(struct tac_handle *, const char *); +int tac_set_priv(struct tac_handle *, int); +int tac_set_rem_addr(struct tac_handle *, const char *); +int tac_set_user(struct tac_handle *, const char *); +const char *tac_strerror(struct tac_handle *); +int tac_send_author(struct tac_handle *); +int tac_create_author(struct tac_handle *, int, int, int); +int tac_set_av(struct tac_handle *, u_int, const char *); +char *tac_get_av(struct tac_handle *, u_int); +char *tac_get_av_value(struct tac_handle *, const char *); +void tac_clear_avs(struct tac_handle *); +__END_DECLS + +#endif /* _TACLIB_H_ */ diff --git a/src/include.new/tar.h b/src/include.new/tar.h new file mode 100644 index 0000000..764ca01 --- /dev/null +++ b/src/include.new/tar.h @@ -0,0 +1,73 @@ +/*- + * Copyright (c) 1994 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Chuck Karish of Mindcraft, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)tar.h 8.2 (Berkeley) 1/4/94 + */ + +#ifndef _TAR_H +#define _TAR_H + +#define TMAGIC "ustar" /* ustar and a null */ +#define TMAGLEN 6 +#define TVERSION "00" /* 00 and no null */ +#define TVERSLEN 2 + +/* Values used in typeflag field */ +#define REGTYPE '0' /* Regular file */ +#define AREGTYPE '\0' /* Regular file */ +#define LNKTYPE '1' /* Link */ +#define SYMTYPE '2' /* Reserved */ +#define CHRTYPE '3' /* Character special */ +#define BLKTYPE '4' /* Block special */ +#define DIRTYPE '5' /* Directory */ +#define FIFOTYPE '6' /* FIFO special */ +#define CONTTYPE '7' /* Reserved */ + +/* Bits used in the mode field - values in octal */ +#define TSUID 04000 /* Set UID on execution */ +#define TSGID 02000 /* Set GID on execution */ +#define TSVTX 01000 /* Reserved */ + /* File permissions */ +#define TUREAD 00400 /* Read by owner */ +#define TUWRITE 00200 /* Write by owner */ +#define TUEXEC 00100 /* Execute/Search by owner */ +#define TGREAD 00040 /* Read by group */ +#define TGWRITE 00020 /* Write by group */ +#define TGEXEC 00010 /* Execute/Search by group */ +#define TOREAD 00004 /* Read by other */ +#define TOWRITE 00002 /* Write by other */ +#define TOEXEC 00001 /* Execute/Search by other */ + +#endif diff --git a/src/include.new/tcpd.h b/src/include.new/tcpd.h new file mode 100644 index 0000000..07ef87e --- /dev/null +++ b/src/include.new/tcpd.h @@ -0,0 +1,225 @@ + /* + * @(#) tcpd.h 1.5 96/03/19 16:22:24 + * + * Author: Wietse Venema, Eindhoven University of Technology, The Netherlands. + * + * $FreeBSD: src/contrib/tcp_wrappers/tcpd.h,v 1.2 2000/02/03 10:26:59 shin Exp $ + */ + +/* Structure to describe one communications endpoint. */ + +#define STRING_LENGTH 128 /* hosts, users, processes */ + +struct host_info { + char name[STRING_LENGTH]; /* access via eval_hostname(host) */ + char addr[STRING_LENGTH]; /* access via eval_hostaddr(host) */ +#ifdef INET6 + struct sockaddr *sin; /* socket address or 0 */ +#else + struct sockaddr_in *sin; /* socket address or 0 */ +#endif + struct t_unitdata *unit; /* TLI transport address or 0 */ + struct request_info *request; /* for shared information */ +}; + +/* Structure to describe what we know about a service request. */ + +struct request_info { + int fd; /* socket handle */ + char user[STRING_LENGTH]; /* access via eval_user(request) */ + char daemon[STRING_LENGTH]; /* access via eval_daemon(request) */ + char pid[10]; /* access via eval_pid(request) */ + struct host_info client[1]; /* client endpoint info */ + struct host_info server[1]; /* server endpoint info */ + void (*sink) (); /* datagram sink function or 0 */ + void (*hostname) (); /* address to printable hostname */ + void (*hostaddr) (); /* address to printable address */ + void (*cleanup) (); /* cleanup function or 0 */ + struct netconfig *config; /* netdir handle */ +}; + +/* Common string operations. Less clutter should be more readable. */ + +#define STRN_CPY(d,s,l) { strncpy((d),(s),(l)); (d)[(l)-1] = 0; } + +#define STRN_EQ(x,y,l) (strncasecmp((x),(y),(l)) == 0) +#define STRN_NE(x,y,l) (strncasecmp((x),(y),(l)) != 0) +#define STR_EQ(x,y) (strcasecmp((x),(y)) == 0) +#define STR_NE(x,y) (strcasecmp((x),(y)) != 0) + + /* + * Initially, all above strings have the empty value. Information that + * cannot be determined at runtime is set to "unknown", so that we can + * distinguish between `unavailable' and `not yet looked up'. A hostname + * that we do not believe in is set to "paranoid". + */ + +#define STRING_UNKNOWN "unknown" /* lookup failed */ +#define STRING_PARANOID "paranoid" /* hostname conflict */ + +extern char unknown[]; +extern char paranoid[]; + +#define HOSTNAME_KNOWN(s) (STR_NE((s),unknown) && STR_NE((s),paranoid)) + +#define NOT_INADDR(s) (s[strspn(s,"01234567890./")] != 0) + +/* Global functions. */ + +#if defined(TLI) || defined(PTX) || defined(TLI_SEQUENT) +extern void fromhost(); /* get/validate client host info */ +#else +#define fromhost sock_host /* no TLI support needed */ +#endif + +extern int hosts_access(); /* access control */ +extern void shell_cmd(); /* execute shell command */ +extern char *percent_x(); /* do % expansion */ +extern void rfc931(); /* client name from RFC 931 daemon */ +extern void clean_exit(); /* clean up and exit */ +extern void refuse(); /* clean up and exit */ +extern char *xgets(); /* fgets() on steroids */ +extern char *split_at(); /* strchr() and split */ +extern unsigned long dot_quad_addr(); /* restricted inet_addr() */ + +/* Global variables. */ + +extern int allow_severity; /* for connection logging */ +extern int deny_severity; /* for connection logging */ +extern char *hosts_allow_table; /* for verification mode redirection */ +extern char *hosts_deny_table; /* for verification mode redirection */ +extern int hosts_access_verbose; /* for verbose matching mode */ +extern int rfc931_timeout; /* user lookup timeout */ +extern int resident; /* > 0 if resident process */ + + /* + * Routines for controlled initialization and update of request structure + * attributes. Each attribute has its own key. + */ + +#ifdef __STDC__ +extern struct request_info *request_init(struct request_info *,...); +extern struct request_info *request_set(struct request_info *,...); +#else +extern struct request_info *request_init(); /* initialize request */ +extern struct request_info *request_set(); /* update request structure */ +#endif + +#define RQ_FILE 1 /* file descriptor */ +#define RQ_DAEMON 2 /* server process (argv[0]) */ +#define RQ_USER 3 /* client user name */ +#define RQ_CLIENT_NAME 4 /* client host name */ +#define RQ_CLIENT_ADDR 5 /* client host address */ +#define RQ_CLIENT_SIN 6 /* client endpoint (internal) */ +#define RQ_SERVER_NAME 7 /* server host name */ +#define RQ_SERVER_ADDR 8 /* server host address */ +#define RQ_SERVER_SIN 9 /* server endpoint (internal) */ + + /* + * Routines for delayed evaluation of request attributes. Each attribute + * type has its own access method. The trivial ones are implemented by + * macros. The other ones are wrappers around the transport-specific host + * name, address, and client user lookup methods. The request_info and + * host_info structures serve as caches for the lookup results. + */ + +extern char *eval_user(); /* client user */ +extern char *eval_hostname(); /* printable hostname */ +extern char *eval_hostaddr(); /* printable host address */ +extern char *eval_hostinfo(); /* host name or address */ +extern char *eval_client(); /* whatever is available */ +extern char *eval_server(); /* whatever is available */ +#define eval_daemon(r) ((r)->daemon) /* daemon process name */ +#define eval_pid(r) ((r)->pid) /* process id */ + +/* Socket-specific methods, including DNS hostname lookups. */ + +extern void sock_host(); /* look up endpoint addresses */ +extern void sock_hostname(); /* translate address to hostname */ +extern void sock_hostaddr(); /* address to printable address */ +#define sock_methods(r) \ + { (r)->hostname = sock_hostname; (r)->hostaddr = sock_hostaddr; } + +/* The System V Transport-Level Interface (TLI) interface. */ + +#if defined(TLI) || defined(PTX) || defined(TLI_SEQUENT) +extern void tli_host(); /* look up endpoint addresses etc. */ +#endif + + /* + * Problem reporting interface. Additional file/line context is reported + * when available. The jump buffer (tcpd_buf) is not declared here, or + * everyone would have to include . + */ + +#ifdef __STDC__ +extern void tcpd_warn(char *, ...); /* report problem and proceed */ +extern void tcpd_jump(char *, ...); /* report problem and jump */ +#else +extern void tcpd_warn(); +extern void tcpd_jump(); +#endif + +struct tcpd_context { + char *file; /* current file */ + int line; /* current line */ +}; +extern struct tcpd_context tcpd_context; + + /* + * While processing access control rules, error conditions are handled by + * jumping back into the hosts_access() routine. This is cleaner than + * checking the return value of each and every silly little function. The + * (-1) returns are here because zero is already taken by longjmp(). + */ + +#define AC_PERMIT 1 /* permit access */ +#define AC_DENY (-1) /* deny_access */ +#define AC_ERROR AC_DENY /* XXX */ + + /* + * In verification mode an option function should just say what it would do, + * instead of really doing it. An option function that would not return + * should clear the dry_run flag to inform the caller of this unusual + * behavior. + */ + +extern void process_options(); /* execute options */ +extern int dry_run; /* verification flag */ + +/* Bug workarounds. */ + +#ifdef INET_ADDR_BUG /* inet_addr() returns struct */ +#define inet_addr fix_inet_addr +extern long fix_inet_addr(); +#endif + +#ifdef BROKEN_FGETS /* partial reads from sockets */ +#define fgets fix_fgets +extern char *fix_fgets(); +#endif + +#ifdef RECVFROM_BUG /* no address family info */ +#define recvfrom fix_recvfrom +extern int fix_recvfrom(); +#endif + +#ifdef GETPEERNAME_BUG /* claims success with UDP */ +#define getpeername fix_getpeername +extern int fix_getpeername(); +#endif + +#ifdef SOLARIS_24_GETHOSTBYNAME_BUG /* lists addresses as aliases */ +#define gethostbyname fix_gethostbyname +extern struct hostent *fix_gethostbyname(); +#endif + +#ifdef USE_STRSEP /* libc calls strtok() */ +#define strtok fix_strtok +extern char *fix_strtok(); +#endif + +#ifdef LIBC_CALLS_STRTOK /* libc calls strtok() */ +#define strtok my_strtok +extern char *my_strtok(); +#endif diff --git a/src/include.new/term.h b/src/include.new/term.h new file mode 100644 index 0000000..0261d50 --- /dev/null +++ b/src/include.new/term.h @@ -0,0 +1,782 @@ +/**************************************************************************** + * Copyright (c) 1998,1999,2000,2001 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/****************************************************************************/ +/* Author: Zeyd M. Ben-Halim 1992,1995 */ +/* and: Eric S. Raymond */ +/****************************************************************************/ + +/* $Id$ */ + +/* +** term.h -- Definition of struct term +*/ + +#ifndef NCURSES_TERM_H_incl +#define NCURSES_TERM_H_incl 1 + +#undef NCURSES_VERSION +#define NCURSES_VERSION "5.2" + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Make this file self-contained by providing defaults for the HAVE_TERMIO[S]_H + * definition (based on the system for which this was configured). + */ + +#undef HAVE_TERMIOS_H +#define HAVE_TERMIOS_H 1 + +#undef HAVE_TCGETATTR +#define HAVE_TCGETATTR 1 + +#undef NCURSES_CONST +#define NCURSES_CONST const + +#undef NCURSES_XNAMES +#define NCURSES_XNAMES 1 + +/* We will use these symbols to hide differences between + * termios/termio/sgttyb interfaces. + */ +#undef TTY +#undef SET_TTY +#undef GET_TTY + +/* Assume POSIX termio if we have the header and function */ +#if HAVE_TERMIOS_H && HAVE_TCGETATTR + +#undef TERMIOS +#define TERMIOS 1 + +#include +#define TTY struct termios + +#else /* !HAVE_TERMIOS_H */ + +#if 0 /* HAVE_TERMIO_H */ + +#undef TERMIOS +#define TERMIOS 1 + +#include +#define TTY struct termio + +/* Add definitions to make termio look like termios. + * But ifdef it, since there are some implementations + * that try to do this for us in a fake . + */ +#ifndef TCSANOW +#define TCSANOW TCSETA +#endif +#ifndef TCSADRAIN +#define TCSADRAIN TCSETAW +#endif +#ifndef TCSAFLUSH +#define TCSAFLUSH TCSETAF +#endif +#ifndef tcsetattr +#define tcsetattr(fd, cmd, arg) ioctl(fd, cmd, arg) +#endif +#ifndef tcgetattr +#define tcgetattr(fd, arg) ioctl(fd, TCGETA, arg) +#endif +#ifndef cfgetospeed +#define cfgetospeed(t) ((t)->c_cflag & CBAUD) +#endif +#ifndef TCIFLUSH +#define TCIFLUSH 0 +#endif +#ifndef TCOFLUSH +#define TCOFLUSH 1 +#endif +#ifndef TCIOFLUSH +#define TCIOFLUSH 2 +#endif +#ifndef tcflush +#define tcflush(fd, arg) ioctl(fd, TCFLSH, arg) +#endif + +#else /* !HAVE_TERMIO_H */ + +#undef TERMIOS +#include +#include +#define TTY struct sgttyb + +#endif /* HAVE_TERMIO_H */ + +#endif /* HAVE_TERMIOS_H */ + +#ifdef TERMIOS +#define GET_TTY(fd, buf) tcgetattr(fd, buf) +#define SET_TTY(fd, buf) tcsetattr(fd, TCSADRAIN, buf) +#else +#define GET_TTY(fd, buf) gtty(fd, buf) +#define SET_TTY(fd, buf) stty(fd, buf) +#endif + +#define NAMESIZE 256 + +#define CUR cur_term->type. + +#define auto_left_margin CUR Booleans[0] +#define auto_right_margin CUR Booleans[1] +#define no_esc_ctlc CUR Booleans[2] +#define ceol_standout_glitch CUR Booleans[3] +#define eat_newline_glitch CUR Booleans[4] +#define erase_overstrike CUR Booleans[5] +#define generic_type CUR Booleans[6] +#define hard_copy CUR Booleans[7] +#define has_meta_key CUR Booleans[8] +#define has_status_line CUR Booleans[9] +#define insert_null_glitch CUR Booleans[10] +#define memory_above CUR Booleans[11] +#define memory_below CUR Booleans[12] +#define move_insert_mode CUR Booleans[13] +#define move_standout_mode CUR Booleans[14] +#define over_strike CUR Booleans[15] +#define status_line_esc_ok CUR Booleans[16] +#define dest_tabs_magic_smso CUR Booleans[17] +#define tilde_glitch CUR Booleans[18] +#define transparent_underline CUR Booleans[19] +#define xon_xoff CUR Booleans[20] +#define needs_xon_xoff CUR Booleans[21] +#define prtr_silent CUR Booleans[22] +#define hard_cursor CUR Booleans[23] +#define non_rev_rmcup CUR Booleans[24] +#define no_pad_char CUR Booleans[25] +#define non_dest_scroll_region CUR Booleans[26] +#define can_change CUR Booleans[27] +#define back_color_erase CUR Booleans[28] +#define hue_lightness_saturation CUR Booleans[29] +#define col_addr_glitch CUR Booleans[30] +#define cr_cancels_micro_mode CUR Booleans[31] +#define has_print_wheel CUR Booleans[32] +#define row_addr_glitch CUR Booleans[33] +#define semi_auto_right_margin CUR Booleans[34] +#define cpi_changes_res CUR Booleans[35] +#define lpi_changes_res CUR Booleans[36] +#define columns CUR Numbers[0] +#define init_tabs CUR Numbers[1] +#define lines CUR Numbers[2] +#define lines_of_memory CUR Numbers[3] +#define magic_cookie_glitch CUR Numbers[4] +#define padding_baud_rate CUR Numbers[5] +#define virtual_terminal CUR Numbers[6] +#define width_status_line CUR Numbers[7] +#define num_labels CUR Numbers[8] +#define label_height CUR Numbers[9] +#define label_width CUR Numbers[10] +#define max_attributes CUR Numbers[11] +#define maximum_windows CUR Numbers[12] +#define max_colors CUR Numbers[13] +#define max_pairs CUR Numbers[14] +#define no_color_video CUR Numbers[15] +#define buffer_capacity CUR Numbers[16] +#define dot_vert_spacing CUR Numbers[17] +#define dot_horz_spacing CUR Numbers[18] +#define max_micro_address CUR Numbers[19] +#define max_micro_jump CUR Numbers[20] +#define micro_col_size CUR Numbers[21] +#define micro_line_size CUR Numbers[22] +#define number_of_pins CUR Numbers[23] +#define output_res_char CUR Numbers[24] +#define output_res_line CUR Numbers[25] +#define output_res_horz_inch CUR Numbers[26] +#define output_res_vert_inch CUR Numbers[27] +#define print_rate CUR Numbers[28] +#define wide_char_size CUR Numbers[29] +#define buttons CUR Numbers[30] +#define bit_image_entwining CUR Numbers[31] +#define bit_image_type CUR Numbers[32] +#define back_tab CUR Strings[0] +#define bell CUR Strings[1] +#define carriage_return CUR Strings[2] +#define change_scroll_region CUR Strings[3] +#define clear_all_tabs CUR Strings[4] +#define clear_screen CUR Strings[5] +#define clr_eol CUR Strings[6] +#define clr_eos CUR Strings[7] +#define column_address CUR Strings[8] +#define command_character CUR Strings[9] +#define cursor_address CUR Strings[10] +#define cursor_down CUR Strings[11] +#define cursor_home CUR Strings[12] +#define cursor_invisible CUR Strings[13] +#define cursor_left CUR Strings[14] +#define cursor_mem_address CUR Strings[15] +#define cursor_normal CUR Strings[16] +#define cursor_right CUR Strings[17] +#define cursor_to_ll CUR Strings[18] +#define cursor_up CUR Strings[19] +#define cursor_visible CUR Strings[20] +#define delete_character CUR Strings[21] +#define delete_line CUR Strings[22] +#define dis_status_line CUR Strings[23] +#define down_half_line CUR Strings[24] +#define enter_alt_charset_mode CUR Strings[25] +#define enter_blink_mode CUR Strings[26] +#define enter_bold_mode CUR Strings[27] +#define enter_ca_mode CUR Strings[28] +#define enter_delete_mode CUR Strings[29] +#define enter_dim_mode CUR Strings[30] +#define enter_insert_mode CUR Strings[31] +#define enter_secure_mode CUR Strings[32] +#define enter_protected_mode CUR Strings[33] +#define enter_reverse_mode CUR Strings[34] +#define enter_standout_mode CUR Strings[35] +#define enter_underline_mode CUR Strings[36] +#define erase_chars CUR Strings[37] +#define exit_alt_charset_mode CUR Strings[38] +#define exit_attribute_mode CUR Strings[39] +#define exit_ca_mode CUR Strings[40] +#define exit_delete_mode CUR Strings[41] +#define exit_insert_mode CUR Strings[42] +#define exit_standout_mode CUR Strings[43] +#define exit_underline_mode CUR Strings[44] +#define flash_screen CUR Strings[45] +#define form_feed CUR Strings[46] +#define from_status_line CUR Strings[47] +#define init_1string CUR Strings[48] +#define init_2string CUR Strings[49] +#define init_3string CUR Strings[50] +#define init_file CUR Strings[51] +#define insert_character CUR Strings[52] +#define insert_line CUR Strings[53] +#define insert_padding CUR Strings[54] +#define key_backspace CUR Strings[55] +#define key_catab CUR Strings[56] +#define key_clear CUR Strings[57] +#define key_ctab CUR Strings[58] +#define key_dc CUR Strings[59] +#define key_dl CUR Strings[60] +#define key_down CUR Strings[61] +#define key_eic CUR Strings[62] +#define key_eol CUR Strings[63] +#define key_eos CUR Strings[64] +#define key_f0 CUR Strings[65] +#define key_f1 CUR Strings[66] +#define key_f10 CUR Strings[67] +#define key_f2 CUR Strings[68] +#define key_f3 CUR Strings[69] +#define key_f4 CUR Strings[70] +#define key_f5 CUR Strings[71] +#define key_f6 CUR Strings[72] +#define key_f7 CUR Strings[73] +#define key_f8 CUR Strings[74] +#define key_f9 CUR Strings[75] +#define key_home CUR Strings[76] +#define key_ic CUR Strings[77] +#define key_il CUR Strings[78] +#define key_left CUR Strings[79] +#define key_ll CUR Strings[80] +#define key_npage CUR Strings[81] +#define key_ppage CUR Strings[82] +#define key_right CUR Strings[83] +#define key_sf CUR Strings[84] +#define key_sr CUR Strings[85] +#define key_stab CUR Strings[86] +#define key_up CUR Strings[87] +#define keypad_local CUR Strings[88] +#define keypad_xmit CUR Strings[89] +#define lab_f0 CUR Strings[90] +#define lab_f1 CUR Strings[91] +#define lab_f10 CUR Strings[92] +#define lab_f2 CUR Strings[93] +#define lab_f3 CUR Strings[94] +#define lab_f4 CUR Strings[95] +#define lab_f5 CUR Strings[96] +#define lab_f6 CUR Strings[97] +#define lab_f7 CUR Strings[98] +#define lab_f8 CUR Strings[99] +#define lab_f9 CUR Strings[100] +#define meta_off CUR Strings[101] +#define meta_on CUR Strings[102] +#define newline CUR Strings[103] +#define pad_char CUR Strings[104] +#define parm_dch CUR Strings[105] +#define parm_delete_line CUR Strings[106] +#define parm_down_cursor CUR Strings[107] +#define parm_ich CUR Strings[108] +#define parm_index CUR Strings[109] +#define parm_insert_line CUR Strings[110] +#define parm_left_cursor CUR Strings[111] +#define parm_right_cursor CUR Strings[112] +#define parm_rindex CUR Strings[113] +#define parm_up_cursor CUR Strings[114] +#define pkey_key CUR Strings[115] +#define pkey_local CUR Strings[116] +#define pkey_xmit CUR Strings[117] +#define print_screen CUR Strings[118] +#define prtr_off CUR Strings[119] +#define prtr_on CUR Strings[120] +#define repeat_char CUR Strings[121] +#define reset_1string CUR Strings[122] +#define reset_2string CUR Strings[123] +#define reset_3string CUR Strings[124] +#define reset_file CUR Strings[125] +#define restore_cursor CUR Strings[126] +#define row_address CUR Strings[127] +#define save_cursor CUR Strings[128] +#define scroll_forward CUR Strings[129] +#define scroll_reverse CUR Strings[130] +#define set_attributes CUR Strings[131] +#define set_tab CUR Strings[132] +#define set_window CUR Strings[133] +#define tab CUR Strings[134] +#define to_status_line CUR Strings[135] +#define underline_char CUR Strings[136] +#define up_half_line CUR Strings[137] +#define init_prog CUR Strings[138] +#define key_a1 CUR Strings[139] +#define key_a3 CUR Strings[140] +#define key_b2 CUR Strings[141] +#define key_c1 CUR Strings[142] +#define key_c3 CUR Strings[143] +#define prtr_non CUR Strings[144] +#define char_padding CUR Strings[145] +#define acs_chars CUR Strings[146] +#define plab_norm CUR Strings[147] +#define key_btab CUR Strings[148] +#define enter_xon_mode CUR Strings[149] +#define exit_xon_mode CUR Strings[150] +#define enter_am_mode CUR Strings[151] +#define exit_am_mode CUR Strings[152] +#define xon_character CUR Strings[153] +#define xoff_character CUR Strings[154] +#define ena_acs CUR Strings[155] +#define label_on CUR Strings[156] +#define label_off CUR Strings[157] +#define key_beg CUR Strings[158] +#define key_cancel CUR Strings[159] +#define key_close CUR Strings[160] +#define key_command CUR Strings[161] +#define key_copy CUR Strings[162] +#define key_create CUR Strings[163] +#define key_end CUR Strings[164] +#define key_enter CUR Strings[165] +#define key_exit CUR Strings[166] +#define key_find CUR Strings[167] +#define key_help CUR Strings[168] +#define key_mark CUR Strings[169] +#define key_message CUR Strings[170] +#define key_move CUR Strings[171] +#define key_next CUR Strings[172] +#define key_open CUR Strings[173] +#define key_options CUR Strings[174] +#define key_previous CUR Strings[175] +#define key_print CUR Strings[176] +#define key_redo CUR Strings[177] +#define key_reference CUR Strings[178] +#define key_refresh CUR Strings[179] +#define key_replace CUR Strings[180] +#define key_restart CUR Strings[181] +#define key_resume CUR Strings[182] +#define key_save CUR Strings[183] +#define key_suspend CUR Strings[184] +#define key_undo CUR Strings[185] +#define key_sbeg CUR Strings[186] +#define key_scancel CUR Strings[187] +#define key_scommand CUR Strings[188] +#define key_scopy CUR Strings[189] +#define key_screate CUR Strings[190] +#define key_sdc CUR Strings[191] +#define key_sdl CUR Strings[192] +#define key_select CUR Strings[193] +#define key_send CUR Strings[194] +#define key_seol CUR Strings[195] +#define key_sexit CUR Strings[196] +#define key_sfind CUR Strings[197] +#define key_shelp CUR Strings[198] +#define key_shome CUR Strings[199] +#define key_sic CUR Strings[200] +#define key_sleft CUR Strings[201] +#define key_smessage CUR Strings[202] +#define key_smove CUR Strings[203] +#define key_snext CUR Strings[204] +#define key_soptions CUR Strings[205] +#define key_sprevious CUR Strings[206] +#define key_sprint CUR Strings[207] +#define key_sredo CUR Strings[208] +#define key_sreplace CUR Strings[209] +#define key_sright CUR Strings[210] +#define key_srsume CUR Strings[211] +#define key_ssave CUR Strings[212] +#define key_ssuspend CUR Strings[213] +#define key_sundo CUR Strings[214] +#define req_for_input CUR Strings[215] +#define key_f11 CUR Strings[216] +#define key_f12 CUR Strings[217] +#define key_f13 CUR Strings[218] +#define key_f14 CUR Strings[219] +#define key_f15 CUR Strings[220] +#define key_f16 CUR Strings[221] +#define key_f17 CUR Strings[222] +#define key_f18 CUR Strings[223] +#define key_f19 CUR Strings[224] +#define key_f20 CUR Strings[225] +#define key_f21 CUR Strings[226] +#define key_f22 CUR Strings[227] +#define key_f23 CUR Strings[228] +#define key_f24 CUR Strings[229] +#define key_f25 CUR Strings[230] +#define key_f26 CUR Strings[231] +#define key_f27 CUR Strings[232] +#define key_f28 CUR Strings[233] +#define key_f29 CUR Strings[234] +#define key_f30 CUR Strings[235] +#define key_f31 CUR Strings[236] +#define key_f32 CUR Strings[237] +#define key_f33 CUR Strings[238] +#define key_f34 CUR Strings[239] +#define key_f35 CUR Strings[240] +#define key_f36 CUR Strings[241] +#define key_f37 CUR Strings[242] +#define key_f38 CUR Strings[243] +#define key_f39 CUR Strings[244] +#define key_f40 CUR Strings[245] +#define key_f41 CUR Strings[246] +#define key_f42 CUR Strings[247] +#define key_f43 CUR Strings[248] +#define key_f44 CUR Strings[249] +#define key_f45 CUR Strings[250] +#define key_f46 CUR Strings[251] +#define key_f47 CUR Strings[252] +#define key_f48 CUR Strings[253] +#define key_f49 CUR Strings[254] +#define key_f50 CUR Strings[255] +#define key_f51 CUR Strings[256] +#define key_f52 CUR Strings[257] +#define key_f53 CUR Strings[258] +#define key_f54 CUR Strings[259] +#define key_f55 CUR Strings[260] +#define key_f56 CUR Strings[261] +#define key_f57 CUR Strings[262] +#define key_f58 CUR Strings[263] +#define key_f59 CUR Strings[264] +#define key_f60 CUR Strings[265] +#define key_f61 CUR Strings[266] +#define key_f62 CUR Strings[267] +#define key_f63 CUR Strings[268] +#define clr_bol CUR Strings[269] +#define clear_margins CUR Strings[270] +#define set_left_margin CUR Strings[271] +#define set_right_margin CUR Strings[272] +#define label_format CUR Strings[273] +#define set_clock CUR Strings[274] +#define display_clock CUR Strings[275] +#define remove_clock CUR Strings[276] +#define create_window CUR Strings[277] +#define goto_window CUR Strings[278] +#define hangup CUR Strings[279] +#define dial_phone CUR Strings[280] +#define quick_dial CUR Strings[281] +#define tone CUR Strings[282] +#define pulse CUR Strings[283] +#define flash_hook CUR Strings[284] +#define fixed_pause CUR Strings[285] +#define wait_tone CUR Strings[286] +#define user0 CUR Strings[287] +#define user1 CUR Strings[288] +#define user2 CUR Strings[289] +#define user3 CUR Strings[290] +#define user4 CUR Strings[291] +#define user5 CUR Strings[292] +#define user6 CUR Strings[293] +#define user7 CUR Strings[294] +#define user8 CUR Strings[295] +#define user9 CUR Strings[296] +#define orig_pair CUR Strings[297] +#define orig_colors CUR Strings[298] +#define initialize_color CUR Strings[299] +#define initialize_pair CUR Strings[300] +#define set_color_pair CUR Strings[301] +#define set_foreground CUR Strings[302] +#define set_background CUR Strings[303] +#define change_char_pitch CUR Strings[304] +#define change_line_pitch CUR Strings[305] +#define change_res_horz CUR Strings[306] +#define change_res_vert CUR Strings[307] +#define define_char CUR Strings[308] +#define enter_doublewide_mode CUR Strings[309] +#define enter_draft_quality CUR Strings[310] +#define enter_italics_mode CUR Strings[311] +#define enter_leftward_mode CUR Strings[312] +#define enter_micro_mode CUR Strings[313] +#define enter_near_letter_quality CUR Strings[314] +#define enter_normal_quality CUR Strings[315] +#define enter_shadow_mode CUR Strings[316] +#define enter_subscript_mode CUR Strings[317] +#define enter_superscript_mode CUR Strings[318] +#define enter_upward_mode CUR Strings[319] +#define exit_doublewide_mode CUR Strings[320] +#define exit_italics_mode CUR Strings[321] +#define exit_leftward_mode CUR Strings[322] +#define exit_micro_mode CUR Strings[323] +#define exit_shadow_mode CUR Strings[324] +#define exit_subscript_mode CUR Strings[325] +#define exit_superscript_mode CUR Strings[326] +#define exit_upward_mode CUR Strings[327] +#define micro_column_address CUR Strings[328] +#define micro_down CUR Strings[329] +#define micro_left CUR Strings[330] +#define micro_right CUR Strings[331] +#define micro_row_address CUR Strings[332] +#define micro_up CUR Strings[333] +#define order_of_pins CUR Strings[334] +#define parm_down_micro CUR Strings[335] +#define parm_left_micro CUR Strings[336] +#define parm_right_micro CUR Strings[337] +#define parm_up_micro CUR Strings[338] +#define select_char_set CUR Strings[339] +#define set_bottom_margin CUR Strings[340] +#define set_bottom_margin_parm CUR Strings[341] +#define set_left_margin_parm CUR Strings[342] +#define set_right_margin_parm CUR Strings[343] +#define set_top_margin CUR Strings[344] +#define set_top_margin_parm CUR Strings[345] +#define start_bit_image CUR Strings[346] +#define start_char_set_def CUR Strings[347] +#define stop_bit_image CUR Strings[348] +#define stop_char_set_def CUR Strings[349] +#define subscript_characters CUR Strings[350] +#define superscript_characters CUR Strings[351] +#define these_cause_cr CUR Strings[352] +#define zero_motion CUR Strings[353] +#define char_set_names CUR Strings[354] +#define key_mouse CUR Strings[355] +#define mouse_info CUR Strings[356] +#define req_mouse_pos CUR Strings[357] +#define get_mouse CUR Strings[358] +#define set_a_foreground CUR Strings[359] +#define set_a_background CUR Strings[360] +#define pkey_plab CUR Strings[361] +#define device_type CUR Strings[362] +#define code_set_init CUR Strings[363] +#define set0_des_seq CUR Strings[364] +#define set1_des_seq CUR Strings[365] +#define set2_des_seq CUR Strings[366] +#define set3_des_seq CUR Strings[367] +#define set_lr_margin CUR Strings[368] +#define set_tb_margin CUR Strings[369] +#define bit_image_repeat CUR Strings[370] +#define bit_image_newline CUR Strings[371] +#define bit_image_carriage_return CUR Strings[372] +#define color_names CUR Strings[373] +#define define_bit_image_region CUR Strings[374] +#define end_bit_image_region CUR Strings[375] +#define set_color_band CUR Strings[376] +#define set_page_length CUR Strings[377] +#define display_pc_char CUR Strings[378] +#define enter_pc_charset_mode CUR Strings[379] +#define exit_pc_charset_mode CUR Strings[380] +#define enter_scancode_mode CUR Strings[381] +#define exit_scancode_mode CUR Strings[382] +#define pc_term_options CUR Strings[383] +#define scancode_escape CUR Strings[384] +#define alt_scancode_esc CUR Strings[385] +#define enter_horizontal_hl_mode CUR Strings[386] +#define enter_left_hl_mode CUR Strings[387] +#define enter_low_hl_mode CUR Strings[388] +#define enter_right_hl_mode CUR Strings[389] +#define enter_top_hl_mode CUR Strings[390] +#define enter_vertical_hl_mode CUR Strings[391] +#define set_a_attributes CUR Strings[392] +#define set_pglen_inch CUR Strings[393] + +#define BOOLWRITE 37 +#define NUMWRITE 33 +#define STRWRITE 394 + +/* older synonyms for some capabilities */ +#define beehive_glitch no_esc_ctlc +#define teleray_glitch dest_tabs_magic_smso +#define micro_char_size micro_col_size + +#ifdef __INTERNAL_CAPS_VISIBLE +#define termcap_init2 CUR Strings[394] +#define termcap_reset CUR Strings[395] +#define magic_cookie_glitch_ul CUR Numbers[33] +#define backspaces_with_bs CUR Booleans[37] +#define crt_no_scrolling CUR Booleans[38] +#define no_correctly_working_cr CUR Booleans[39] +#define carriage_return_delay CUR Numbers[34] +#define new_line_delay CUR Numbers[35] +#define linefeed_if_not_lf CUR Strings[396] +#define backspace_if_not_bs CUR Strings[397] +#define gnu_has_meta_key CUR Booleans[40] +#define linefeed_is_newline CUR Booleans[41] +#define backspace_delay CUR Numbers[36] +#define horizontal_tab_delay CUR Numbers[37] +#define number_of_function_keys CUR Numbers[38] +#define other_non_function_keys CUR Strings[398] +#define arrow_key_map CUR Strings[399] +#define has_hardware_tabs CUR Booleans[42] +#define return_does_clr_eol CUR Booleans[43] +#define acs_ulcorner CUR Strings[400] +#define acs_llcorner CUR Strings[401] +#define acs_urcorner CUR Strings[402] +#define acs_lrcorner CUR Strings[403] +#define acs_ltee CUR Strings[404] +#define acs_rtee CUR Strings[405] +#define acs_btee CUR Strings[406] +#define acs_ttee CUR Strings[407] +#define acs_hline CUR Strings[408] +#define acs_vline CUR Strings[409] +#define acs_plus CUR Strings[410] +#define memory_lock CUR Strings[411] +#define memory_unlock CUR Strings[412] +#define box_chars_1 CUR Strings[413] +#endif /* __INTERNAL_CAPS_VISIBLE */ + + +/* + * Predefined terminfo array sizes + */ +#define BOOLCOUNT 44 +#define NUMCOUNT 39 +#define STRCOUNT 414 + +/* used by code for comparing entries */ +#define acs_chars_index 146 + +typedef struct termtype { /* in-core form of terminfo data */ + char *term_names; /* str_table offset of term names */ + char *str_table; /* pointer to string table */ + char *Booleans; /* array of boolean values */ + short *Numbers; /* array of integer values */ + char **Strings; /* array of string offsets */ + +#if NCURSES_XNAMES + char *ext_str_table; /* pointer to extended string table */ + char **ext_Names; /* corresponding names */ + + unsigned short num_Booleans;/* count total Booleans */ + unsigned short num_Numbers; /* count total Numbers */ + unsigned short num_Strings; /* count total Strings */ + + unsigned short ext_Booleans;/* count extensions to Booleans */ + unsigned short ext_Numbers; /* count extensions to Numbers */ + unsigned short ext_Strings; /* count extensions to Strings */ +#endif /* NCURSES_XNAMES */ + +} TERMTYPE; + +typedef struct term { /* describe an actual terminal */ + TERMTYPE type; /* terminal type description */ + short Filedes; /* file description being written to */ + TTY Ottyb, /* original state of the terminal */ + Nttyb; /* current state of the terminal */ + int _baudrate; /* used to compute padding */ +} TERMINAL; + +extern NCURSES_EXPORT_VAR(TERMINAL *) cur_term; + +#if 0 /* BROKEN_LINKER */ +#define boolnames _nc_boolnames() +#define boolcodes _nc_boolcodes() +#define boolfnames _nc_boolfnames() +#define numnames _nc_numnames() +#define numcodes _nc_numcodes() +#define numfnames _nc_numfnames() +#define strnames _nc_strnames() +#define strcodes _nc_strcodes() +#define strfnames _nc_strfnames() + +extern NCURSES_EXPORT(NCURSES_CONST char * const *) _nc_boolnames (void); +extern NCURSES_EXPORT(NCURSES_CONST char * const *) _nc_boolcodes (void); +extern NCURSES_EXPORT(NCURSES_CONST char * const *) _nc_boolfnames (void); +extern NCURSES_EXPORT(NCURSES_CONST char * const *) _nc_numnames (void); +extern NCURSES_EXPORT(NCURSES_CONST char * const *) _nc_numcodes (void); +extern NCURSES_EXPORT(NCURSES_CONST char * const *) _nc_numfnames (void); +extern NCURSES_EXPORT(NCURSES_CONST char * const *) _nc_strnames (void); +extern NCURSES_EXPORT(NCURSES_CONST char * const *) _nc_strcodes (void); +extern NCURSES_EXPORT(NCURSES_CONST char * const *) _nc_strfnames (void); + +#else + +extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) boolnames[]; +extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) boolcodes[]; +extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) boolfnames[]; +extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) numnames[]; +extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) numcodes[]; +extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) numfnames[]; +extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) strnames[]; +extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) strcodes[]; +extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) strfnames[]; + +#endif + +/* internals */ +extern NCURSES_EXPORT(int) _nc_set_tty_mode (TTY *buf); +extern NCURSES_EXPORT(int) _nc_get_tty_mode (TTY *buf); +extern NCURSES_EXPORT(int) _nc_read_entry (const char * const, char * const, TERMTYPE *const); +extern NCURSES_EXPORT(int) _nc_read_file_entry (const char *const, TERMTYPE *); +extern NCURSES_EXPORT(char *) _nc_first_name (const char *const); +extern NCURSES_EXPORT(int) _nc_name_match (const char *const, const char *const, const char *const); +extern NCURSES_EXPORT(int) _nc_read_termcap_entry (const char *const, TERMTYPE *const); +extern NCURSES_EXPORT(const TERMTYPE *) _nc_fallback (const char *); + +/* entry points */ +extern NCURSES_EXPORT(TERMINAL *) set_curterm (TERMINAL *); +extern NCURSES_EXPORT(int) del_curterm (TERMINAL *); + +/* miscellaneous entry points */ +extern NCURSES_EXPORT(int) restartterm (NCURSES_CONST char *, int, int *); +extern NCURSES_EXPORT(int) setupterm (NCURSES_CONST char *,int,int *); + +/* terminfo entry points, also declared in curses.h */ +#if !defined(__NCURSES_H) +extern NCURSES_EXPORT(char *) tigetstr (NCURSES_CONST char *); +extern NCURSES_EXPORT(char *) tparm (NCURSES_CONST char *, ...); +extern NCURSES_EXPORT_VAR(char) ttytype[]; +extern NCURSES_EXPORT(int) putp (const char *); +extern NCURSES_EXPORT(int) tigetflag (NCURSES_CONST char *); +extern NCURSES_EXPORT(int) tigetnum (NCURSES_CONST char *); +#endif /* __NCURSES_H */ + +/* termcap database emulation (XPG4 uses const only for 2nd param of tgetent) */ +#if !defined(NCURSES_TERMCAP_H_incl) +extern NCURSES_EXPORT(char *) tgetstr (NCURSES_CONST char *, char **); +extern NCURSES_EXPORT(char *) tgoto (const char *, int, int); +extern NCURSES_EXPORT(int) tgetent (char *, const char *); +extern NCURSES_EXPORT(int) tgetflag (NCURSES_CONST char *); +extern NCURSES_EXPORT(int) tgetnum (NCURSES_CONST char *); +extern NCURSES_EXPORT(int) tputs (const char *, int, int (*)(int)); +#endif /* NCURSES_TERMCAP_H_incl */ + +#ifdef __cplusplus +} +#endif + +#endif /* NCURSES_TERM_H_incl */ diff --git a/src/include.new/termcap.h b/src/include.new/termcap.h new file mode 100644 index 0000000..bc90c9b --- /dev/null +++ b/src/include.new/termcap.h @@ -0,0 +1,75 @@ +/**************************************************************************** + * Copyright (c) 1998,2000 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ + +/* $Id$ */ + +#ifndef NCURSES_TERMCAP_H_incl +#define NCURSES_TERMCAP_H_incl 1 + +#undef NCURSES_VERSION +#define NCURSES_VERSION "5.2" + +#include + +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +#include + +#undef NCURSES_CONST +#define NCURSES_CONST const + +#undef NCURSES_OSPEED +#define NCURSES_OSPEED short + +extern NCURSES_EXPORT_VAR(char) PC; +extern NCURSES_EXPORT_VAR(char *) UP; +extern NCURSES_EXPORT_VAR(char *) BC; +extern NCURSES_EXPORT_VAR(NCURSES_OSPEED) ospeed; + +#if !defined(NCURSES_TERM_H_incl) +extern NCURSES_EXPORT(char *) tgetstr (NCURSES_CONST char *, char **); +extern NCURSES_EXPORT(char *) tgoto (const char *, int, int); +extern NCURSES_EXPORT(int) tgetent (char *, const char *); +extern NCURSES_EXPORT(int) tgetflag (NCURSES_CONST char *); +extern NCURSES_EXPORT(int) tgetnum (NCURSES_CONST char *); +extern NCURSES_EXPORT(int) tputs (const char *, int, int (*)(int)); +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* NCURSES_TERMCAP_H_incl */ diff --git a/src/include.new/termios.h b/src/include.new/termios.h new file mode 100644 index 0000000..9a3cb2e --- /dev/null +++ b/src/include.new/termios.h @@ -0,0 +1,284 @@ +/*- + * Copyright (c) 1988, 1989, 1993, 1994 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)termios.h 8.3 (Berkeley) 3/28/94 + * $FreeBSD: src/sys/sys/termios.h,v 1.20 2005/01/07 02:29:24 imp Exp $ + */ + +#ifndef _SYS_TERMIOS_H_ +#define _SYS_TERMIOS_H_ + +/* + * Special Control Characters + * + * Index into c_cc[] character array. + * + * Name Subscript Enabled by + */ +#define VEOF 0 /* ICANON */ +#define VEOL 1 /* ICANON */ +#ifndef _POSIX_SOURCE +#define VEOL2 2 /* ICANON together with IEXTEN */ +#endif +#define VERASE 3 /* ICANON */ +#ifndef _POSIX_SOURCE +#define VWERASE 4 /* ICANON together with IEXTEN */ +#endif +#define VKILL 5 /* ICANON */ +#ifndef _POSIX_SOURCE +#define VREPRINT 6 /* ICANON together with IEXTEN */ +#define VERASE2 7 /* ICANON */ +#endif +/* 7 ex-spare 1 */ +#define VINTR 8 /* ISIG */ +#define VQUIT 9 /* ISIG */ +#define VSUSP 10 /* ISIG */ +#ifndef _POSIX_SOURCE +#define VDSUSP 11 /* ISIG together with IEXTEN */ +#endif +#define VSTART 12 /* IXON, IXOFF */ +#define VSTOP 13 /* IXON, IXOFF */ +#ifndef _POSIX_SOURCE +#define VLNEXT 14 /* IEXTEN */ +#define VDISCARD 15 /* IEXTEN */ +#endif +#define VMIN 16 /* !ICANON */ +#define VTIME 17 /* !ICANON */ +#ifndef _POSIX_SOURCE +#define VSTATUS 18 /* ICANON together with IEXTEN */ +/* 19 spare 2 */ +#endif +#define NCCS 20 + +#define _POSIX_VDISABLE 0xff + +#ifndef _POSIX_SOURCE +#define CCEQ(val, c) ((c) == (val) ? (val) != _POSIX_VDISABLE : 0) +#endif + +/* + * Input flags - software input processing + */ +#define IGNBRK 0x00000001 /* ignore BREAK condition */ +#define BRKINT 0x00000002 /* map BREAK to SIGINTR */ +#define IGNPAR 0x00000004 /* ignore (discard) parity errors */ +#define PARMRK 0x00000008 /* mark parity and framing errors */ +#define INPCK 0x00000010 /* enable checking of parity errors */ +#define ISTRIP 0x00000020 /* strip 8th bit off chars */ +#define INLCR 0x00000040 /* map NL into CR */ +#define IGNCR 0x00000080 /* ignore CR */ +#define ICRNL 0x00000100 /* map CR to NL (ala CRMOD) */ +#define IXON 0x00000200 /* enable output flow control */ +#define IXOFF 0x00000400 /* enable input flow control */ +#ifndef _POSIX_SOURCE +#define IXANY 0x00000800 /* any char will restart after stop */ +#define IMAXBEL 0x00002000 /* ring bell on input queue full */ +#endif /*_POSIX_SOURCE */ + +/* + * Output flags - software output processing + */ +#define OPOST 0x00000001 /* enable following output processing */ +#ifndef _POSIX_SOURCE +#define ONLCR 0x00000002 /* map NL to CR-NL (ala CRMOD) */ +#define OXTABS 0x00000004 /* expand tabs to spaces */ +#define ONOEOT 0x00000008 /* discard EOT's (^D) on output) */ +#define OCRNL 0x00000010 /* map CR to NL on output */ +#define ONOCR 0x00000020 /* no CR output at column 0 */ +#define ONLRET 0x00000040 /* NL performs CR function */ +#endif /*_POSIX_SOURCE */ + +/* + * Control flags - hardware control of terminal + */ +#ifndef _POSIX_SOURCE +#define CIGNORE 0x00000001 /* ignore control flags */ +#endif +#define CSIZE 0x00000300 /* character size mask */ +#define CS5 0x00000000 /* 5 bits (pseudo) */ +#define CS6 0x00000100 /* 6 bits */ +#define CS7 0x00000200 /* 7 bits */ +#define CS8 0x00000300 /* 8 bits */ +#define CSTOPB 0x00000400 /* send 2 stop bits */ +#define CREAD 0x00000800 /* enable receiver */ +#define PARENB 0x00001000 /* parity enable */ +#define PARODD 0x00002000 /* odd parity, else even */ +#define HUPCL 0x00004000 /* hang up on last close */ +#define CLOCAL 0x00008000 /* ignore modem status lines */ +#ifndef _POSIX_SOURCE +#define CCTS_OFLOW 0x00010000 /* CTS flow control of output */ +#define CRTSCTS (CCTS_OFLOW | CRTS_IFLOW) +#define CRTS_IFLOW 0x00020000 /* RTS flow control of input */ +#define CDTR_IFLOW 0x00040000 /* DTR flow control of input */ +#define CDSR_OFLOW 0x00080000 /* DSR flow control of output */ +#define CCAR_OFLOW 0x00100000 /* DCD flow control of output */ +#define MDMBUF 0x00100000 /* old name for CCAR_OFLOW */ +#endif + + +/* + * "Local" flags - dumping ground for other state + * + * Warning: some flags in this structure begin with + * the letter "I" and look like they belong in the + * input flag. + */ + +#ifndef _POSIX_SOURCE +#define ECHOKE 0x00000001 /* visual erase for line kill */ +#endif /*_POSIX_SOURCE */ +#define ECHOE 0x00000002 /* visually erase chars */ +#define ECHOK 0x00000004 /* echo NL after line kill */ +#define ECHO 0x00000008 /* enable echoing */ +#define ECHONL 0x00000010 /* echo NL even if ECHO is off */ +#ifndef _POSIX_SOURCE +#define ECHOPRT 0x00000020 /* visual erase mode for hardcopy */ +#define ECHOCTL 0x00000040 /* echo control chars as ^(Char) */ +#endif /*_POSIX_SOURCE */ +#define ISIG 0x00000080 /* enable signals INTR, QUIT, [D]SUSP */ +#define ICANON 0x00000100 /* canonicalize input lines */ +#ifndef _POSIX_SOURCE +#define ALTWERASE 0x00000200 /* use alternate WERASE algorithm */ +#endif /*_POSIX_SOURCE */ +#define IEXTEN 0x00000400 /* enable DISCARD and LNEXT */ +#define EXTPROC 0x00000800 /* external processing */ +#define TOSTOP 0x00400000 /* stop background jobs from output */ +#ifndef _POSIX_SOURCE +#define FLUSHO 0x00800000 /* output being flushed (state) */ +#define NOKERNINFO 0x02000000 /* no kernel output from VSTATUS */ +#define PENDIN 0x20000000 /* XXX retype pending input (state) */ +#endif /*_POSIX_SOURCE */ +#define NOFLSH 0x80000000 /* don't flush after interrupt */ + +typedef unsigned int tcflag_t; +typedef unsigned char cc_t; +typedef unsigned int speed_t; + +struct termios { + tcflag_t c_iflag; /* input flags */ + tcflag_t c_oflag; /* output flags */ + tcflag_t c_cflag; /* control flags */ + tcflag_t c_lflag; /* local flags */ + cc_t c_cc[NCCS]; /* control chars */ + speed_t c_ispeed; /* input speed */ + speed_t c_ospeed; /* output speed */ +}; + +/* + * Commands passed to tcsetattr() for setting the termios structure. + */ +#define TCSANOW 0 /* make change immediate */ +#define TCSADRAIN 1 /* drain output, then change */ +#define TCSAFLUSH 2 /* drain output, flush input */ +#ifndef _POSIX_SOURCE +#define TCSASOFT 0x10 /* flag - don't alter h.w. state */ +#endif + +/* + * Standard speeds + */ +#define B0 0 +#define B50 50 +#define B75 75 +#define B110 110 +#define B134 134 +#define B150 150 +#define B200 200 +#define B300 300 +#define B600 600 +#define B1200 1200 +#define B1800 1800 +#define B2400 2400 +#define B4800 4800 +#define B9600 9600 +#define B19200 19200 +#define B38400 38400 +#ifndef _POSIX_SOURCE +#define B7200 7200 +#define B14400 14400 +#define B28800 28800 +#define B57600 57600 +#define B76800 76800 +#define B115200 115200 +#define B230400 230400 +#define B460800 460800 +#define B921600 921600 +#define EXTA 19200 +#define EXTB 38400 +#endif /* !_POSIX_SOURCE */ + +#ifndef _KERNEL + +#define TCIFLUSH 1 +#define TCOFLUSH 2 +#define TCIOFLUSH 3 +#define TCOOFF 1 +#define TCOON 2 +#define TCIOFF 3 +#define TCION 4 + +#include + +__BEGIN_DECLS +speed_t cfgetispeed(const struct termios *); +speed_t cfgetospeed(const struct termios *); +int cfsetispeed(struct termios *, speed_t); +int cfsetospeed(struct termios *, speed_t); +int tcgetattr(int, struct termios *); +int tcsetattr(int, int, const struct termios *); +int tcdrain(int); +int tcflow(int, int); +int tcflush(int, int); +int tcsendbreak(int, int); + +#ifndef _POSIX_SOURCE +void cfmakeraw(struct termios *); +int cfsetspeed(struct termios *, speed_t); +#endif /* !_POSIX_SOURCE */ +__END_DECLS + +#endif /* !_KERNEL */ + +#ifndef _POSIX_SOURCE + +/* + * Include tty ioctl's that aren't just for backwards compatibility + * with the old tty driver. These ioctl definitions were previously + * in . + */ +#include +#endif + +/* + * END OF PROTECTED INCLUDE. + */ +#endif /* !_SYS_TERMIOS_H_ */ + +#ifndef _POSIX_SOURCE +#include +#endif diff --git a/src/include.new/tgmath.h b/src/include.new/tgmath.h new file mode 100644 index 0000000..b3cb64d --- /dev/null +++ b/src/include.new/tgmath.h @@ -0,0 +1,167 @@ +/*- + * Copyright (c) 2004 Stefan Farfeleder. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD: src/include/tgmath.h,v 1.4 2004/09/03 23:44:09 stefanf Exp $ + */ + +#ifndef _TGMATH_H_ +#define _TGMATH_H_ + +#include +#include + +/* + * This implementation of requires two implementation-dependent + * macros to be defined: + * __tg_impl_simple(x, y, z, fn, fnf, fnl, ...) + * Invokes fnl() if the corresponding real type of x, y or z is long + * double, fn() if it is double or any has an integer type, and fnf() + * otherwise. + * __tg_impl_full(x, y, z, fn, fnf, fnl, cfn, cfnf, cfnl, ...) + * Invokes [c]fnl() if the corresponding real type of x, y or z is long + * double, [c]fn() if it is double or any has an integer type, and + * [c]fnf() otherwise. The function with the 'c' prefix is called if + * any of x, y or z is a complex number. + * Both macros call the chosen function with all additional arguments passed + * to them, as given by __VA_ARGS__. + * + * Note that these macros cannot be implemented with C's ?: operator, + * because the return type of the whole expression would incorrectly be long + * double complex regardless of the argument types. + */ + +#if __GNUC_PREREQ__(3, 1) +#define __tg_type(e, t) __builtin_types_compatible_p(__typeof__(e), t) +#define __tg_type3(e1, e2, e3, t) \ + (__tg_type(e1, t) || __tg_type(e2, t) || __tg_type(e3, t)) +#define __tg_type_corr(e1, e2, e3, t) \ + (__tg_type3(e1, e2, e3, t) || __tg_type3(e1, e2, e3, t _Complex)) +#define __tg_integer(e1, e2, e3) \ + (((__typeof__(e1))1.5 == 1) || ((__typeof__(e2))1.5 == 1) || \ + ((__typeof__(e3))1.5 == 1)) +#define __tg_is_complex(e1, e2, e3) \ + (__tg_type3(e1, e2, e3, float _Complex) || \ + __tg_type3(e1, e2, e3, double _Complex) || \ + __tg_type3(e1, e2, e3, long double _Complex)) || \ + __tg_type3(e1, e2, e3, __typeof__(_Complex_I)) + +#define __tg_impl_simple(x, y, z, fn, fnf, fnl, ...) \ + __builtin_choose_expr(__tg_type_corr(x, y, z, long double), \ + fnl(__VA_ARGS__), __builtin_choose_expr( \ + __tg_type_corr(x, y, z, double) || __tg_integer(x, y, z),\ + fn(__VA_ARGS__), fnf(__VA_ARGS__))) + +#define __tg_impl_full(x, y, z, fn, fnf, fnl, cfn, cfnf, cfnl, ...) \ + __builtin_choose_expr(__tg_is_complex(x, y, z), \ + __tg_impl_simple(x, y, z, cfn, cfnf, cfnl, __VA_ARGS__), \ + __tg_impl_simple(x, y, z, fn, fnf, fnl, __VA_ARGS__)) + +#else /* __GNUC__ */ +#error " not implemented for this compiler" +#endif /* !__GNUC__ */ + +/* Macros to save lots of repetition below */ +#define __tg_simple(x, fn) \ + __tg_impl_simple(x, x, x, fn, fn##f, fn##l, x) +#define __tg_simple2(x, y, fn) \ + __tg_impl_simple(x, x, y, fn, fn##f, fn##l, x, y) +#define __tg_simplev(x, fn, ...) \ + __tg_impl_simple(x, x, x, fn, fn##f, fn##l, __VA_ARGS__) +#define __tg_full(x, fn) \ + __tg_impl_full(x, x, x, fn, fn##f, fn##l, c##fn, c##fn##f, c##fn##l, x) + +/* 7.22#4 -- These macros expand to real or complex functions, depending on + * the type of their arguments. */ +#define acos(x) __tg_full(x, acos) +#define asin(x) __tg_full(x, asin) +#define atan(x) __tg_full(x, atan) +#define acosh(x) __tg_full(x, acosh) +#define asinh(x) __tg_full(x, asinh) +#define atanh(x) __tg_full(x, atanh) +#define cos(x) __tg_full(x, cos) +#define sin(x) __tg_full(x, sin) +#define tan(x) __tg_full(x, tan) +#define cosh(x) __tg_full(x, cosh) +#define sinh(x) __tg_full(x, sinh) +#define tanh(x) __tg_full(x, tanh) +#define exp(x) __tg_full(x, exp) +#define log(x) __tg_full(x, log) +#define pow(x, y) __tg_impl_full(x, x, y, pow, powf, powl, \ + cpow, cpowf, cpowl, x, y) +#define sqrt(x) __tg_full(x, sqrt) + +/* "The corresponding type-generic macro for fabs and cabs is fabs." */ +#define fabs(x) __tg_impl_full(x, x, x, fabs, fabsf, fabsl, \ + cabs, cabsf, cabsl, x) + +/* 7.22#5 -- These macros are only defined for arguments with real type. */ +#define atan2(x, y) __tg_simple2(x, y, atan2) +#define cbrt(x) __tg_simple(x, cbrt) +#define ceil(x) __tg_simple(x, ceil) +#define copysign(x, y) __tg_simple2(x, y, copysign) +#define erf(x) __tg_simple(x, erf) +#define erfc(x) __tg_simple(x, erfc) +#define exp2(x) __tg_simple(x, exp2) +#define expm1(x) __tg_simple(x, expm1) +#define fdim(x, y) __tg_simple2(x, y, fdim) +#define floor(x) __tg_simple(x, floor) +#define fma(x, y, z) __tg_impl_simple(x, y, z, fma, fmaf, fmal, x, y, z) +#define fmax(x, y) __tg_simple2(x, y, fmax) +#define fmin(x, y) __tg_simple2(x, y, fmin) +#define fmod(x, y) __tg_simple2(x, y, fmod) +#define frexp(x, y) __tg_simplev(x, frexp, x, y) +#define hypot(x, y) __tg_simple2(x, y, hypot) +#define ilogb(x) __tg_simple(x, ilogb) +#define ldexp(x, y) __tg_simplev(x, ldexp, x, y) +#define lgamma(x) __tg_simple(x, lgamma) +#define llrint(x) __tg_simple(x, llrint) +#define llround(x) __tg_simple(x, llround) +#define log10(x) __tg_simple(x, log10) +#define log1p(x) __tg_simple(x, log1p) +#define log2(x) __tg_simple(x, log2) +#define logb(x) __tg_simple(x, logb) +#define lrint(x) __tg_simple(x, lrint) +#define lround(x) __tg_simple(x, lround) +#define nearbyint(x) __tg_simple(x, nearbyint) +#define nextafter(x, y) __tg_simple2(x, y, nextafter) +#define nexttoward(x, y) __tg_simplev(x, nexttoward, x, y) +#define remainder(x, y) __tg_simple2(x, y, remainder) +#define remquo(x, y, z) __tg_impl_simple(x, x, y, remquo, remquof, \ + remquol, x, y, z) +#define rint(x) __tg_simple(x, rint) +#define round(x) __tg_simple(x, round) +#define scalbn(x, y) __tg_simplev(x, scalbn, x, y) +#define scalbln(x, y) __tg_simplev(x, scalbln, x, y) +#define tgamma(x) __tg_simple(x, tgamma) +#define trunc(x) __tg_simple(x, trunc) + +/* 7.22#6 -- These macros always expand to complex functions. */ +#define carg(x) __tg_simple(x, carg) +#define cimag(x) __tg_simple(x, cimag) +#define conj(x) __tg_simple(x, conj) +#define cproj(x) __tg_simple(x, cproj) +#define creal(x) __tg_simple(x, creal) + +#endif /* !_TGMATH_H_ */ diff --git a/src/include.new/thread_db.h b/src/include.new/thread_db.h new file mode 100644 index 0000000..b46f984 --- /dev/null +++ b/src/include.new/thread_db.h @@ -0,0 +1,248 @@ +/* + * Copyright (c) 2004 David Xu + * Copyright (c) 2004 Marcel Moolenaar + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * $FreeBSD: src/lib/libthread_db/thread_db.h,v 1.6 2005/05/31 09:43:03 dfr Exp $ + */ + +#ifndef _THREAD_DB_H_ +#define _THREAD_DB_H_ + +#include +#include + +typedef enum { + TD_ERR = -1, /* Unspecified error. */ + TD_OK = 0, /* No error. */ + TD_BADKEY, + TD_BADPH, + TD_BADSH, + TD_BADTA, + TD_BADTH, + TD_DBERR, + TD_MALLOC, + TD_NOAPLIC, + TD_NOCAPAB, + TD_NOEVENT, + TD_NOFPREGS, + TD_NOLIBTHREAD, + TD_NOLWP, + TD_NOMSG, + TD_NOSV, + TD_NOTHR, + TD_NOTSD, + TD_NOXREGS, + TD_PARTIALREG +} td_err_e; + +struct ps_prochandle; +typedef struct td_thragent td_thragent_t; +typedef long thread_t; /* Must be an integral type. */ + +typedef struct { + const td_thragent_t *th_ta; + psaddr_t th_thread; + thread_t th_tid; +} td_thrhandle_t; /* Used non-opaguely. */ + +/* + * Events. + */ + +typedef enum { + TD_EVENT_NONE = 0, + TD_CATCHSIG = 0x0001, + TD_CONCURRENCY= 0x0002, + TD_CREATE = 0x0004, + TD_DEATH = 0x0008, + TD_IDLE = 0x0010, + TD_LOCK_TRY = 0x0020, + TD_PREEMPT = 0x0040, + TD_PRI_INHERIT= 0x0080, + TD_READY = 0x0100, + TD_REAP = 0x0200, + TD_SLEEP = 0x0400, + TD_SWITCHFROM = 0x0800, + TD_SWITCHTO = 0x1000, + TD_TIMEOUT = 0x2000, + TD_ALL_EVENTS = ~0 +} td_thr_events_e; + +/* Compatibility with Linux. */ +#define td_event_e td_thr_events_e + +typedef struct { + td_thr_events_e event; + const td_thrhandle_t *th_p; + uintptr_t data; +} td_event_msg_t; + +typedef unsigned int td_thr_events_t; + +typedef enum { + NOTIFY_BPT, /* User inserted breakpoint. */ + NOTIFY_AUTOBPT, /* Automatic breakpoint. */ + NOTIFY_SYSCALL /* Invocation of system call. */ +} td_notify_e; + +typedef struct { + td_notify_e type; + union { + psaddr_t bptaddr; + int syscallno; + } u; +} td_notify_t; + +static __inline void +td_event_addset(td_thr_events_t *es, td_thr_events_e e) +{ + *es |= e; +} + +static __inline void +td_event_delset(td_thr_events_t *es, td_thr_events_e e) +{ + *es &= ~e; +} + +static __inline void +td_event_emptyset(td_thr_events_t *es) +{ + *es = TD_EVENT_NONE; +} + +static __inline void +td_event_fillset(td_thr_events_t *es) +{ + *es = TD_ALL_EVENTS; +} + +static __inline int +td_eventisempty(td_thr_events_t *es) +{ + return ((*es == TD_EVENT_NONE) ? 1 : 0); +} + +static __inline int +td_eventismember(td_thr_events_t *es, td_thr_events_e e) +{ + return ((*es & e) ? 1 : 0); +} + +/* + * Thread info. + */ + +typedef enum { + TD_THR_UNKNOWN = -1, + TD_THR_ANY_STATE = 0, + TD_THR_ACTIVE, + TD_THR_RUN, + TD_THR_SLEEP, + TD_THR_STOPPED, + TD_THR_STOPPED_ASLEEP, + TD_THR_ZOMBIE +} td_thr_state_e; + +typedef enum +{ + TD_THR_SYSTEM = 1, + TD_THR_USER +} td_thr_type_e; + +typedef pthread_key_t thread_key_t; + +typedef struct { + const td_thragent_t *ti_ta_p; + thread_t ti_tid; + psaddr_t ti_thread; + td_thr_state_e ti_state; + td_thr_type_e ti_type; + td_thr_events_t ti_events; + int ti_pri; + lwpid_t ti_lid; + char ti_db_suspended; + char ti_traceme; + sigset_t ti_sigmask; + sigset_t ti_pending; + psaddr_t ti_tls; + psaddr_t ti_startfunc; + psaddr_t ti_stkbase; + size_t ti_stksize; +} td_thrinfo_t; + +/* + * Prototypes. + */ + +typedef int td_key_iter_f(thread_key_t, void (*)(void *), void *); +typedef int td_thr_iter_f(const td_thrhandle_t *, void *); + +/* Flags for `td_ta_thr_iter'. */ +#define TD_THR_ANY_USER_FLAGS 0xffffffff +#define TD_THR_LOWEST_PRIORITY -20 +#define TD_SIGNO_MASK NULL + +__BEGIN_DECLS +td_err_e td_init(void); + +td_err_e td_ta_clear_event(const td_thragent_t *, td_thr_events_t *); +td_err_e td_ta_delete(td_thragent_t *); +td_err_e td_ta_event_addr(const td_thragent_t *, td_thr_events_e, + td_notify_t *); +td_err_e td_ta_event_getmsg(const td_thragent_t *, td_event_msg_t *); +td_err_e td_ta_map_id2thr(const td_thragent_t *, thread_t, td_thrhandle_t *); +td_err_e td_ta_map_lwp2thr(const td_thragent_t *, lwpid_t, td_thrhandle_t *); +td_err_e td_ta_new(struct ps_prochandle *, td_thragent_t **); +td_err_e td_ta_set_event(const td_thragent_t *, td_thr_events_t *); +td_err_e td_ta_thr_iter(const td_thragent_t *, td_thr_iter_f *, void *, + td_thr_state_e, int, sigset_t *, unsigned int); +td_err_e td_ta_tsd_iter(const td_thragent_t *, td_key_iter_f *, void *); + +td_err_e td_thr_clear_event(const td_thrhandle_t *, td_thr_events_t *); +td_err_e td_thr_dbresume(const td_thrhandle_t *); +td_err_e td_thr_dbsuspend(const td_thrhandle_t *); +td_err_e td_thr_event_enable(const td_thrhandle_t *, int); +td_err_e td_thr_event_getmsg(const td_thrhandle_t *, td_event_msg_t *); +td_err_e td_thr_get_info(const td_thrhandle_t *, td_thrinfo_t *); +#ifdef __i386__ +td_err_e td_thr_getxmmregs(const td_thrhandle_t *, char *); +#endif +td_err_e td_thr_getfpregs(const td_thrhandle_t *, prfpregset_t *); +td_err_e td_thr_getgregs(const td_thrhandle_t *, prgregset_t); +td_err_e td_thr_set_event(const td_thrhandle_t *, td_thr_events_t *); +#ifdef __i386__ +td_err_e td_thr_setxmmregs(const td_thrhandle_t *, const char *); +#endif +td_err_e td_thr_setfpregs(const td_thrhandle_t *, const prfpregset_t *); +td_err_e td_thr_setgregs(const td_thrhandle_t *, const prgregset_t); +td_err_e td_thr_validate(const td_thrhandle_t *); +td_err_e td_thr_tls_get_addr(const td_thrhandle_t *, void *, size_t, void **); + +/* FreeBSD specific extensions. */ +td_err_e td_thr_sstep(const td_thrhandle_t *, int); +__END_DECLS + +#endif /* _THREAD_DB_H_ */ diff --git a/src/include.new/time.h b/src/include.new/time.h new file mode 100644 index 0000000..59f1fb0 --- /dev/null +++ b/src/include.new/time.h @@ -0,0 +1,175 @@ +/* + * Copyright (c) 1989, 1993 + * The Regents of the University of California. All rights reserved. + * (c) UNIX System Laboratories, Inc. + * All or some portions of this file are derived from material licensed + * to the University of California by American Telephone and Telegraph + * Co. or Unix System Laboratories, Inc. and are reproduced herein with + * the permission of UNIX System Laboratories, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)time.h 8.3 (Berkeley) 1/21/94 + */ + +/* + * $FreeBSD: src/include/time.h,v 1.32 2005/04/02 12:33:27 das Exp $ + */ + +#ifndef _TIME_H_ +#define _TIME_H_ + +#include +#include +#include + +#if __POSIX_VISIBLE > 0 && __POSIX_VISIBLE < 200112 || __BSD_VISIBLE +/* + * Frequency of the clock ticks reported by times(). Deprecated - use + * sysconf(_SC_CLK_TCK) instead. (Removed in 1003.1-2001.) + */ +#define CLK_TCK 128 +#endif + +/* Frequency of the clock ticks reported by clock(). */ +#define CLOCKS_PER_SEC 128 + +#ifndef _CLOCK_T_DECLARED +typedef __clock_t clock_t; +#define _CLOCK_T_DECLARED +#endif + +#ifndef _TIME_T_DECLARED +typedef __time_t time_t; +#define _TIME_T_DECLARED +#endif + +#ifndef _SIZE_T_DECLARED +typedef __size_t size_t; +#define _SIZE_T_DECLARED +#endif + +#if __POSIX_VISIBLE >= 199309 +/* + * New in POSIX 1003.1b-1993. + */ +#ifndef _CLOCKID_T_DECLARED +typedef __clockid_t clockid_t; +#define _CLOCKID_T_DECLARED +#endif + +#ifndef _TIMER_T_DECLARED +typedef __timer_t timer_t; +#define _TIMER_T_DECLARED +#endif + +#include +#endif /* __POSIX_VISIBLE >= 199309 */ + +/* These macros are also in sys/time.h. */ +#if !defined(CLOCK_REALTIME) && __POSIX_VISIBLE >= 200112 +#define CLOCK_REALTIME 0 +#ifdef __BSD_VISIBLE +#define CLOCK_VIRTUAL 1 +#define CLOCK_PROF 2 +#endif +#define CLOCK_MONOTONIC 4 +#endif /* !defined(CLOCK_REALTIME) && __POSIX_VISIBLE >= 200112 */ + +#if !defined(TIMER_ABSTIME) && __POSIX_VISIBLE >= 200112 +#if __BSD_VISIBLE +#define TIMER_RELTIME 0x0 /* relative timer */ +#endif +#define TIMER_ABSTIME 0x1 /* absolute timer */ +#endif /* !defined(TIMER_ABSTIME) && __POSIX_VISIBLE >= 200112 */ + +struct tm { + int tm_sec; /* seconds after the minute [0-60] */ + int tm_min; /* minutes after the hour [0-59] */ + int tm_hour; /* hours since midnight [0-23] */ + int tm_mday; /* day of the month [1-31] */ + int tm_mon; /* months since January [0-11] */ + int tm_year; /* years since 1900 */ + int tm_wday; /* days since Sunday [0-6] */ + int tm_yday; /* days since January 1 [0-365] */ + int tm_isdst; /* Daylight Savings Time flag */ + long tm_gmtoff; /* offset from UTC in seconds */ + char *tm_zone; /* timezone abbreviation */ +}; + +#if __POSIX_VISIBLE +extern char *tzname[]; +#endif + +__BEGIN_DECLS +char *asctime(const struct tm *); +clock_t clock(void); +char *ctime(const time_t *); +double difftime(time_t, time_t); +/* XXX missing: getdate() */ +struct tm *gmtime(const time_t *); +struct tm *localtime(const time_t *); +time_t mktime(struct tm *); +size_t strftime(char * __restrict, size_t, const char * __restrict, + const struct tm * __restrict); +time_t time(time_t *); + +#if __POSIX_VISIBLE +void tzset(void); +#endif + +#if __POSIX_VISIBLE >= 199309 +int clock_getres(clockid_t, struct timespec *); +int clock_gettime(clockid_t, struct timespec *); +int clock_settime(clockid_t, const struct timespec *); +/* XXX missing: clock_nanosleep() */ +int nanosleep(const struct timespec *, struct timespec *); +#endif /* __POSIX_VISIBLE >= 199309 */ + +#if __POSIX_VISIBLE >= 199506 +char *asctime_r(const struct tm *, char *); +char *ctime_r(const time_t *, char *); +struct tm *gmtime_r(const time_t *, struct tm *); +struct tm *localtime_r(const time_t *, struct tm *); +#endif + +#if __XSI_VISIBLE +char *strptime(const char * __restrict, const char * __restrict, + struct tm * __restrict); +#endif + +#if __BSD_VISIBLE +char *timezone(int, int); /* XXX XSI conflict */ +void tzsetwall(void); +time_t timelocal(struct tm * const); +time_t timegm(struct tm * const); +#endif /* __BSD_VISIBLE */ +__END_DECLS + +#endif /* !_TIME_H_ */ diff --git a/src/include.new/timeconv.h b/src/include.new/timeconv.h new file mode 100644 index 0000000..a9345c6 --- /dev/null +++ b/src/include.new/timeconv.h @@ -0,0 +1,65 @@ +/* + * Copyright (c) 1989, 1993 + * The Regents of the University of California. All rights reserved. + * (c) UNIX System Laboratories, Inc. + * All or some portions of this file are derived from material licensed + * to the University of California by American Telephone and Telegraph + * Co. or Unix System Laboratories, Inc. and are reproduced herein with + * the permission of UNIX System Laboratories, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)time.h 8.3 (Berkeley) 1/21/94 + */ + +/* + * $FreeBSD: src/include/timeconv.h,v 1.2 2002/08/21 16:19:55 mike Exp $ + */ + +#ifndef _TIMECONV_H_ +#define _TIMECONV_H_ + +#include +#include + +#ifndef _TIME_T_DECLARED +typedef __time_t time_t; +#define _TIME_T_DECLARED +#endif + +time_t _time32_to_time(__int32_t t32); +__int32_t _time_to_time32(time_t t); +time_t _time64_to_time(__int64_t t64); +__int64_t _time_to_time64(time_t t); +long _time_to_long(time_t t); +time_t _long_to_time(long tlong); +int _time_to_int(time_t t); +time_t _int_to_time(int tint); + +#endif /* _TIMECONV_H_ */ diff --git a/src/include.new/timers.h b/src/include.new/timers.h new file mode 100644 index 0000000..9a6eacd --- /dev/null +++ b/src/include.new/timers.h @@ -0,0 +1,45 @@ +/* ==== timers.h ============================================================ + * Copyright (c) 1994 by Chris Provenzano, proven@mit.edu + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Chris Provenzano. + * 4. The name of Chris Provenzano may not be used to endorse or promote + * products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY CHRIS PROVENZANO ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL CHRIS PROVENZANO BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD: src/include/timers.h,v 1.4 1999/08/27 23:44:52 peter Exp $ + * + * Description : Basic timers header. + * + * 1.00 94/06/13 proven + * -Started coding this file. + */ + +#ifndef _TIMERS_H_ +#define _TIMERS_H_ + +#include + +#endif diff --git a/src/include.new/ttyent.h b/src/include.new/ttyent.h new file mode 100644 index 0000000..e870d70 --- /dev/null +++ b/src/include.new/ttyent.h @@ -0,0 +1,77 @@ +/* + * Copyright (c) 1989, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)ttyent.h 8.1 (Berkeley) 6/2/93 + * $FreeBSD: src/include/ttyent.h,v 1.7 2002/03/23 17:24:53 imp Exp $ + */ + +#ifndef _TTYENT_H_ +#define _TTYENT_H_ + +#define _PATH_TTYS "/etc/ttys" + +#define _TTYS_OFF "off" +#define _TTYS_ON "on" +#define _TTYS_SECURE "secure" +#define _TTYS_INSECURE "insecure" +#define _TTYS_WINDOW "window" +#define _TTYS_GROUP "group" +#define _TTYS_NOGROUP "none" +#define _TTYS_DIALUP "dialup" +#define _TTYS_NETWORK "network" + +struct ttyent { + char *ty_name; /* terminal device name */ + char *ty_getty; /* command to execute, usually getty */ + char *ty_type; /* terminal type for termcap */ +#define TTY_ON 0x01 /* enable logins (start ty_getty program) */ +#define TTY_SECURE 0x02 /* allow uid of 0 to login */ +#define TTY_DIALUP 0x04 /* is a dialup tty */ +#define TTY_NETWORK 0x08 /* is a network tty */ + int ty_status; /* status flags */ + char *ty_window; /* command to start up window manager */ + char *ty_comment; /* comment field */ + char *ty_group; /* tty group */ +}; + +#include + +__BEGIN_DECLS +struct ttyent *getttyent(void); +struct ttyent *getttynam(const char *); +int setttyent(void); +int endttyent(void); +int isdialuptty(const char *); +int isnettty(const char *); +__END_DECLS + +#endif /* !_TTYENT_H_ */ diff --git a/src/include.new/ucontext.h b/src/include.new/ucontext.h new file mode 100644 index 0000000..6ca4dda --- /dev/null +++ b/src/include.new/ucontext.h @@ -0,0 +1,99 @@ +/*- + * Copyright (c) 1999 Marcel Moolenaar + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer + * in this position and unchanged. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * $FreeBSD: src/sys/sys/ucontext.h,v 1.11 2003/11/09 20:31:04 marcel Exp $ + */ + +#ifndef _SYS_UCONTEXT_H_ +#define _SYS_UCONTEXT_H_ + +#include +#include + +typedef struct __ucontext { + /* + * Keep the order of the first two fields. Also, + * keep them the first two fields in the structure. + * This way we can have a union with struct + * sigcontext and ucontext_t. This allows us to + * support them both at the same time. + * note: the union is not defined, though. + */ + sigset_t uc_sigmask; + mcontext_t uc_mcontext; + + struct __ucontext *uc_link; + stack_t uc_stack; + int uc_flags; +#define UCF_SWAPPED 0x00000001 /* Used by swapcontext(3). */ + int __spare__[4]; +} ucontext_t; + +#if defined(_KERNEL) && defined(COMPAT_FREEBSD4) +#if defined(__i386__) || defined(__alpha__) +struct ucontext4 { + sigset_t uc_sigmask; + struct mcontext4 uc_mcontext; + struct ucontext4 *uc_link; + stack_t uc_stack; + int __spare__[8]; +}; +#else /* __i386__ || __alpha__ */ +#define ucontext4 ucontext +#endif /* __i386__ || __alpha__ */ +#endif /* _KERNEL */ + +#ifndef _KERNEL + +__BEGIN_DECLS + +int getcontext(ucontext_t *); +int setcontext(const ucontext_t *); +void makecontext(ucontext_t *, void (*)(void), int, ...); +int signalcontext(ucontext_t *, int, __sighandler_t *); +int swapcontext(ucontext_t *, const ucontext_t *); + +__END_DECLS + +#else /* _KERNEL */ + +struct thread; + +/* + * Flags for get_mcontext(). The low order 4 bits (i.e a mask of 0x0f) are + * reserved for use by machine independent code. All other bits are for use + * by machine dependent code. + */ +#define GET_MC_CLEAR_RET 1 + +/* Machine-dependent functions: */ +int get_mcontext(struct thread *, mcontext_t *, int); +int set_mcontext(struct thread *, const mcontext_t *); + +#endif /* !_KERNEL */ + +#endif /* !_SYS_UCONTEXT_H_ */ diff --git a/src/include.new/ugidfw.h b/src/include.new/ugidfw.h new file mode 100644 index 0000000..92aebe2 --- /dev/null +++ b/src/include.new/ugidfw.h @@ -0,0 +1,58 @@ +/*- + * Copyright (c) 2002, 2004 Networks Associates Technology, Inc. + * All rights reserved. + * + * This software was developed for the FreeBSD Project by Network Associates + * Laboratories, the Security Research Division of Network Associates, Inc. + * under DARPA/SPAWAR contract N66001-01-C-8035 ("CBOSS"), as part of the + * DARPA CHATS research program. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD: src/lib/libugidfw/ugidfw.h,v 1.4.8.1 2006/08/21 15:59:47 dwmalone Exp $ + */ + +#ifndef _UGIDFW_H +#define _UGIDFW_H + +__BEGIN_DECLS +int bsde_rule_to_string(struct mac_bsdextended_rule *rule, char *buf, + size_t buflen); +int bsde_parse_mode(int argc, char *argv[], mode_t *mode, size_t buflen, + char *errstr); +int bsde_parse_rule(int argc, char *argv[], + struct mac_bsdextended_rule *rule, size_t buflen, char *errstr); +int bsde_parse_rule_string(const char *string, + struct mac_bsdextended_rule *rule, size_t buflen, char *errstr); +int bsde_get_mib(const char *string, int *name, size_t *namelen); +int bsde_get_rule_count(size_t buflen, char *errstr); +int bsde_get_rule_slots(size_t buflen, char *errstr); +int bsde_get_rule(int rulenum, struct mac_bsdextended_rule *rule, + size_t errlen, char *errstr); +int bsde_delete_rule(int rulenum, size_t buflen, char *errstr); +int bsde_set_rule(int rulenum, struct mac_bsdextended_rule *rule, + size_t buflen, char *errstr); +int bsde_add_rule(int *rulename, struct mac_bsdextended_rule *rule, + size_t buflen, char *errstr); +__END_DECLS + +#endif diff --git a/src/include.new/ulimit.h b/src/include.new/ulimit.h new file mode 100644 index 0000000..c6a451c --- /dev/null +++ b/src/include.new/ulimit.h @@ -0,0 +1,41 @@ +/*- + * Copyright (c) 2002 Kyle Martin + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD: src/include/ulimit.h,v 1.4 2003/01/08 01:18:13 tjr Exp $ + */ + +#ifndef _ULIMIT_H_ +#define _ULIMIT_H_ + +#include + +#define UL_GETFSIZE 1 +#define UL_SETFSIZE 2 + +__BEGIN_DECLS +long ulimit(int, ...); +__END_DECLS + +#endif /* !_ULIMIT_H_ */ diff --git a/src/include.new/unctrl.h b/src/include.new/unctrl.h new file mode 100644 index 0000000..567fec8 --- /dev/null +++ b/src/include.new/unctrl.h @@ -0,0 +1,63 @@ +/**************************************************************************** + * Copyright (c) 1998,2000 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ + +/* + * unctrl.h + * + * Display a printable version of a control character. + * Control characters are displayed in caret notation (^x), DELETE is displayed + * as ^?. Printable characters are displayed as is. + */ + +/* $Id$ */ + +#ifndef NCURSES_UNCTRL_H_incl +#define NCURSES_UNCTRL_H_incl 1 + +#undef NCURSES_VERSION +#define NCURSES_VERSION "5.2" + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#undef unctrl +NCURSES_EXPORT(NCURSES_CONST char *) unctrl (chtype); + +#ifdef __cplusplus +} +#endif + +#endif /* NCURSES_UNCTRL_H_incl */ diff --git a/src/include.new/unistd.h b/src/include.new/unistd.h new file mode 100644 index 0000000..b52f571 --- /dev/null +++ b/src/include.new/unistd.h @@ -0,0 +1,560 @@ +/*- + * Copyright (c) 1991, 1993, 1994 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)unistd.h 8.12 (Berkeley) 4/27/95 + * $FreeBSD: src/include/unistd.h,v 1.78 2005/05/13 16:27:30 delphij Exp $ + */ + +#ifndef _UNISTD_H_ +#define _UNISTD_H_ + +#include +#include /* XXX adds too much pollution. */ +#include +#include +#include + +#ifndef _GID_T_DECLARED +typedef __gid_t gid_t; +#define _GID_T_DECLARED +#endif + +#ifndef _OFF_T_DECLARED +typedef __off_t off_t; +#define _OFF_T_DECLARED +#endif + +#ifndef _PID_T_DECLARED +typedef __pid_t pid_t; +#define _PID_T_DECLARED +#endif + +#ifndef _SIZE_T_DECLARED +typedef __size_t size_t; +#define _SIZE_T_DECLARED +#endif + +#ifndef _SSIZE_T_DECLARED +typedef __ssize_t ssize_t; +#define _SSIZE_T_DECLARED +#endif + +#ifndef _UID_T_DECLARED +typedef __uid_t uid_t; +#define _UID_T_DECLARED +#endif + +#ifndef _USECONDS_T_DECLARED +typedef __useconds_t useconds_t; +#define _USECONDS_T_DECLARED +#endif + +#define STDIN_FILENO 0 /* standard input file descriptor */ +#define STDOUT_FILENO 1 /* standard output file descriptor */ +#define STDERR_FILENO 2 /* standard error file descriptor */ + +#if __XSI_VISIBLE || __POSIX_VISIBLE >= 200112 +#define F_ULOCK 0 /* unlock locked section */ +#define F_LOCK 1 /* lock a section for exclusive use */ +#define F_TLOCK 2 /* test and lock a section for exclusive use */ +#define F_TEST 3 /* test a section for locks by other procs */ +#endif + +/* + * POSIX options and option groups we unconditionally do or don't + * implement. This list includes those options which are exclusively + * implemented (or not) in user mode. Please keep this list in + * alphabetical order. + * + * Anything which is defined as zero below **must** have an + * implementation for the corresponding sysconf() which is able to + * determine conclusively whether or not the feature is supported. + * Anything which is defined as other than -1 below **must** have + * complete headers, types, and function declarations as specified by + * the POSIX standard; however, if the relevant sysconf() function + * returns -1, the functions may be stubbed out. + */ +#define _POSIX_BARRIERS -1 +#define _POSIX_READER_WRITER_LOCKS 200112L +#define _POSIX_REGEXP 1 +#define _POSIX_SHELL 1 +#define _POSIX_SPAWN -1 +#define _POSIX_SPIN_LOCKS -1 +#define _POSIX_THREAD_ATTR_STACKADDR 200112L +#define _POSIX_THREAD_ATTR_STACKSIZE 200112L +#define _POSIX_THREAD_CPUTIME -1 +#define _POSIX_THREAD_PRIO_INHERIT 200112L +#define _POSIX_THREAD_PRIO_PROTECT 200112L +#define _POSIX_THREAD_PRIORITY_SCHEDULING 200112L +#define _POSIX_THREAD_PROCESS_SHARED -1 +#define _POSIX_THREAD_SAFE_FUNCTIONS -1 +#define _POSIX_THREAD_SPORADIC_SERVER -1 +#define _POSIX_THREADS 200112L +#define _POSIX_TRACE -1 +#define _POSIX_TRACE_EVENT_FILTER -1 +#define _POSIX_TRACE_INHERIT -1 +#define _POSIX_TRACE_LOG -1 +#define _POSIX2_C_BIND 200112L /* mandatory */ +#define _POSIX2_C_DEV -1 /* need c99 utility */ +#define _POSIX2_CHAR_TERM 1 +#define _POSIX2_FORT_DEV -1 /* need fort77 utility */ +#define _POSIX2_FORT_RUN 200112L +#define _POSIX2_LOCALEDEF -1 +#define _POSIX2_PBS -1 +#define _POSIX2_PBS_ACCOUNTING -1 +#define _POSIX2_PBS_CHECKPOINT -1 +#define _POSIX2_PBS_LOCATE -1 +#define _POSIX2_PBS_MESSAGE -1 +#define _POSIX2_PBS_TRACK -1 +#define _POSIX2_SW_DEV -1 /* XXX ??? */ +#define _POSIX2_UPE 200112L +#define _V6_ILP32_OFF32 -1 +#define _V6_ILP32_OFFBIG 0 +#define _V6_LP64_OFF64 0 +#define _V6_LPBIG_OFFBIG -1 + +#if __XSI_VISIBLE +#define _XOPEN_CRYPT -1 /* XXX ??? */ +#define _XOPEN_ENH_I18N -1 /* mandatory in XSI */ +#define _XOPEN_LEGACY -1 +#define _XOPEN_REALTIME -1 +#define _XOPEN_REALTIME_THREADS -1 +#define _XOPEN_UNIX -1 +#endif + +/* Define the POSIX.2 version we target for compliance. */ +#define _POSIX2_VERSION 199212L + +/* + * POSIX-style system configuration variable accessors (for the + * sysconf function). The kernel does not directly implement the + * sysconf() interface; rather, a C library stub translates references + * to sysconf() into calls to sysctl() using a giant switch statement. + * Those that are marked `user' are implemented entirely in the C + * library and never query the kernel. pathconf() is implemented + * directly by the kernel so those are not defined here. + */ +#define _SC_ARG_MAX 1 +#define _SC_CHILD_MAX 2 +#define _SC_CLK_TCK 3 +#define _SC_NGROUPS_MAX 4 +#define _SC_OPEN_MAX 5 +#define _SC_JOB_CONTROL 6 +#define _SC_SAVED_IDS 7 +#define _SC_VERSION 8 +#define _SC_BC_BASE_MAX 9 /* user */ +#define _SC_BC_DIM_MAX 10 /* user */ +#define _SC_BC_SCALE_MAX 11 /* user */ +#define _SC_BC_STRING_MAX 12 /* user */ +#define _SC_COLL_WEIGHTS_MAX 13 /* user */ +#define _SC_EXPR_NEST_MAX 14 /* user */ +#define _SC_LINE_MAX 15 /* user */ +#define _SC_RE_DUP_MAX 16 /* user */ +#define _SC_2_VERSION 17 /* user */ +#define _SC_2_C_BIND 18 /* user */ +#define _SC_2_C_DEV 19 /* user */ +#define _SC_2_CHAR_TERM 20 /* user */ +#define _SC_2_FORT_DEV 21 /* user */ +#define _SC_2_FORT_RUN 22 /* user */ +#define _SC_2_LOCALEDEF 23 /* user */ +#define _SC_2_SW_DEV 24 /* user */ +#define _SC_2_UPE 25 /* user */ +#define _SC_STREAM_MAX 26 /* user */ +#define _SC_TZNAME_MAX 27 /* user */ + +#if __POSIX_VISIBLE >= 199309 +#define _SC_ASYNCHRONOUS_IO 28 +#define _SC_MAPPED_FILES 29 +#define _SC_MEMLOCK 30 +#define _SC_MEMLOCK_RANGE 31 +#define _SC_MEMORY_PROTECTION 32 +#define _SC_MESSAGE_PASSING 33 +#define _SC_PRIORITIZED_IO 34 +#define _SC_PRIORITY_SCHEDULING 35 +#define _SC_REALTIME_SIGNALS 36 +#define _SC_SEMAPHORES 37 +#define _SC_FSYNC 38 +#define _SC_SHARED_MEMORY_OBJECTS 39 +#define _SC_SYNCHRONIZED_IO 40 +#define _SC_TIMERS 41 +#define _SC_AIO_LISTIO_MAX 42 +#define _SC_AIO_MAX 43 +#define _SC_AIO_PRIO_DELTA_MAX 44 +#define _SC_DELAYTIMER_MAX 45 +#define _SC_MQ_OPEN_MAX 46 +#define _SC_PAGESIZE 47 +#define _SC_RTSIG_MAX 48 +#define _SC_SEM_NSEMS_MAX 49 +#define _SC_SEM_VALUE_MAX 50 +#define _SC_SIGQUEUE_MAX 51 +#define _SC_TIMER_MAX 52 +#endif + +#if __POSIX_VISIBLE >= 200112 +#define _SC_2_PBS 59 /* user */ +#define _SC_2_PBS_ACCOUNTING 60 /* user */ +#define _SC_2_PBS_CHECKPOINT 61 /* user */ +#define _SC_2_PBS_LOCATE 62 /* user */ +#define _SC_2_PBS_MESSAGE 63 /* user */ +#define _SC_2_PBS_TRACK 64 /* user */ +#define _SC_ADVISORY_INFO 65 +#define _SC_BARRIERS 66 /* user */ +#define _SC_CLOCK_SELECTION 67 +#define _SC_CPUTIME 68 +#define _SC_FILE_LOCKING 69 +#define _SC_GETGR_R_SIZE_MAX 70 /* user */ +#define _SC_GETPW_R_SIZE_MAX 71 /* user */ +#define _SC_HOST_NAME_MAX 72 +#define _SC_LOGIN_NAME_MAX 73 +#define _SC_MONOTONIC_CLOCK 74 +#define _SC_MQ_PRIO_MAX 75 +#define _SC_READER_WRITER_LOCKS 76 /* user */ +#define _SC_REGEXP 77 /* user */ +#define _SC_SHELL 78 /* user */ +#define _SC_SPAWN 79 /* user */ +#define _SC_SPIN_LOCKS 80 /* user */ +#define _SC_SPORADIC_SERVER 81 +#define _SC_THREAD_ATTR_STACKADDR 82 /* user */ +#define _SC_THREAD_ATTR_STACKSIZE 83 /* user */ +#define _SC_THREAD_CPUTIME 84 /* user */ +#define _SC_THREAD_DESTRUCTOR_ITERATIONS 85 /* user */ +#define _SC_THREAD_KEYS_MAX 86 /* user */ +#define _SC_THREAD_PRIO_INHERIT 87 /* user */ +#define _SC_THREAD_PRIO_PROTECT 88 /* user */ +#define _SC_THREAD_PRIORITY_SCHEDULING 89 /* user */ +#define _SC_THREAD_PROCESS_SHARED 90 /* user */ +#define _SC_THREAD_SAFE_FUNCTIONS 91 /* user */ +#define _SC_THREAD_SPORADIC_SERVER 92 /* user */ +#define _SC_THREAD_STACK_MIN 93 /* user */ +#define _SC_THREAD_THREADS_MAX 94 /* user */ +#define _SC_TIMEOUTS 95 /* user */ +#define _SC_THREADS 96 /* user */ +#define _SC_TRACE 97 /* user */ +#define _SC_TRACE_EVENT_FILTER 98 /* user */ +#define _SC_TRACE_INHERIT 99 /* user */ +#define _SC_TRACE_LOG 100 /* user */ +#define _SC_TTY_NAME_MAX 101 /* user */ +#define _SC_TYPED_MEMORY_OBJECTS 102 +#define _SC_V6_ILP32_OFF32 103 /* user */ +#define _SC_V6_ILP32_OFFBIG 104 /* user */ +#define _SC_V6_LP64_OFF64 105 /* user */ +#define _SC_V6_LPBIG_OFFBIG 106 /* user */ +#define _SC_IPV6 118 +#define _SC_RAW_SOCKETS 119 +#define _SC_SYMLOOP_MAX 120 +#endif + +#if __XSI_VISIBLE +#define _SC_ATEXIT_MAX 107 /* user */ +#define _SC_IOV_MAX 56 +#define _SC_PAGE_SIZE _SC_PAGESIZE +#define _SC_XOPEN_CRYPT 108 /* user */ +#define _SC_XOPEN_ENH_I18N 109 /* user */ +#define _SC_XOPEN_LEGACY 110 /* user */ +#define _SC_XOPEN_REALTIME 111 +#define _SC_XOPEN_REALTIME_THREADS 112 +#define _SC_XOPEN_SHM 113 +#define _SC_XOPEN_STREAMS 114 +#define _SC_XOPEN_UNIX 115 +#define _SC_XOPEN_VERSION 116 +#define _SC_XOPEN_XCU_VERSION 117 /* user */ +#endif + +#if __BSD_VISIBLE +#define _SC_NPROCESSORS_CONF 57 +#define _SC_NPROCESSORS_ONLN 58 +#endif + +/* Keys for the confstr(3) function. */ +#if __POSIX_VISIBLE >= 199209 +#define _CS_PATH 1 /* default value of PATH */ +#endif + +#if __POSIX_VISIBLE >= 200112 +#define _CS_POSIX_V6_ILP32_OFF32_CFLAGS 2 +#define _CS_POSIX_V6_ILP32_OFF32_LDFLAGS 3 +#define _CS_POSIX_V6_ILP32_OFF32_LIBS 4 +#define _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS 5 +#define _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS 6 +#define _CS_POSIX_V6_ILP32_OFFBIG_LIBS 7 +#define _CS_POSIX_V6_LP64_OFF64_CFLAGS 8 +#define _CS_POSIX_V6_LP64_OFF64_LDFLAGS 9 +#define _CS_POSIX_V6_LP64_OFF64_LIBS 10 +#define _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS 11 +#define _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS 12 +#define _CS_POSIX_V6_LPBIG_OFFBIG_LIBS 13 +#define _CS_POSIX_V6_WIDTH_RESTRICTED_ENVS 14 +#endif + +__BEGIN_DECLS +/* 1003.1-1990 */ +void _exit(int) __dead2; +int access(const char *, int); +unsigned int alarm(unsigned int); +int chdir(const char *); +int chown(const char *, uid_t, gid_t); +int close(int); +int dup(int); +int dup2(int, int); +int eaccess(const char *, int); +int execl(const char *, const char *, ...); +int execle(const char *, const char *, ...); +int execlp(const char *, const char *, ...); +int execv(const char *, char * const *); +int execve(const char *, char * const *, char * const *); +int execvp(const char *, char * const *); +pid_t fork(void); +long fpathconf(int, int); +char *getcwd(char *, size_t); +gid_t getegid(void); +uid_t geteuid(void); +gid_t getgid(void); +int getgroups(int, gid_t []); +char *getlogin(void); +pid_t getpgrp(void); +pid_t getpid(void); +pid_t getppid(void); +uid_t getuid(void); +int isatty(int); +int link(const char *, const char *); +#ifndef _LSEEK_DECLARED +#define _LSEEK_DECLARED +off_t lseek(int, off_t, int); +#endif +long pathconf(const char *, int); +int pause(void); +int pipe(int *); +ssize_t read(int, void *, size_t); +int rmdir(const char *); +int setgid(gid_t); +int setpgid(pid_t, pid_t); +void setproctitle(const char *_fmt, ...) __printf0like(1, 2); +pid_t setsid(void); +int setuid(uid_t); +unsigned int sleep(unsigned int); +long sysconf(int); +pid_t tcgetpgrp(int); +int tcsetpgrp(int, pid_t); +char *ttyname(int); +int ttyname_r(int, char *, size_t); +int unlink(const char *); +ssize_t write(int, const void *, size_t); + +/* 1003.2-1992 */ +#if __POSIX_VISIBLE >= 199209 || __XSI_VISIBLE +size_t confstr(int, char *, size_t); +#ifndef _GETOPT_DECLARED +#define _GETOPT_DECLARED +int getopt(int, char * const [], const char *); + +extern char *optarg; /* getopt(3) external variables */ +extern int optind, opterr, optopt; +#endif /* _GETOPT_DECLARED */ +#endif + +/* ISO/IEC 9945-1: 1996 */ +#if __POSIX_VISIBLE >= 199506 || __XSI_VISIBLE +int fsync(int); + +/* + * ftruncate() was in the POSIX Realtime Extension (it's used for shared + * memory), but truncate() was not. + */ +#ifndef _FTRUNCATE_DECLARED +#define _FTRUNCATE_DECLARED +int ftruncate(int, off_t); +#endif +#endif + +#if __POSIX_VISIBLE >= 199506 +int getlogin_r(char *, int); +#endif + +/* 1003.1-2001 */ +#if __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE +int fchown(int, uid_t, gid_t); +int readlink(const char *, char *, int); +#endif +#if __POSIX_VISIBLE >= 200112 +int gethostname(char *, size_t); +int setegid(gid_t); +int seteuid(uid_t); +#endif + +/* + * symlink() was originally in POSIX.1a, which was withdrawn after + * being overtaken by events (1003.1-2001). It was in XPG4.2, and of + * course has been in BSD since 4.2. + */ +#if __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE >= 402 || __BSD_VISIBLE +int symlink(const char * __restrict, const char * __restrict); +#endif + +/* X/Open System Interfaces */ +#if __XSI_VISIBLE +char *crypt(const char *, const char *); +/* char *ctermid(char *); */ /* XXX ??? */ +int encrypt(char *, int); +int fchdir(int); +long gethostid(void); +int getpgid(pid_t _pid); +int getsid(pid_t _pid); +char *getwd(char *); /* LEGACY: obsoleted by getcwd() */ +int lchown(const char *, uid_t, gid_t); +int lockf(int, int, off_t); +int nice(int); +ssize_t pread(int, void *, size_t, off_t); +ssize_t pwrite(int, const void *, size_t, off_t); +int setpgrp(pid_t _pid, pid_t _pgrp); /* obsoleted by setpgid() */ +int setregid(gid_t, gid_t); +int setreuid(uid_t, uid_t); + +#ifndef _SWAB_DECLARED +#define _SWAB_DECLARED +void swab(const void * __restrict, void * __restrict, ssize_t); +#endif /* _SWAB_DECLARED */ + +void sync(void); +useconds_t ualarm(useconds_t, useconds_t); +int usleep(useconds_t); +pid_t vfork(void); + +/* See comment at ftruncate() above. */ +#ifndef _TRUNCATE_DECLARED +#define _TRUNCATE_DECLARED +int truncate(const char *, off_t); +#endif +#endif /* __XSI_VISIBLE */ + +#if __XSI_VISIBLE <= 500 || __BSD_VISIBLE +int brk(const void *); +int chroot(const char *); +int getdtablesize(void); +int getpagesize(void) __pure2; +char *getpass(const char *); +void *sbrk(intptr_t); +#endif + +#if __BSD_VISIBLE +struct timeval; /* select(2) */ +int acct(const char *); +int async_daemon(void); +int check_utility_compat(const char *); +const char * + crypt_get_format(void); +int crypt_set_format(const char *); +int des_cipher(const char *, char *, long, int); +int des_setkey(const char *key); +void endusershell(void); +int exect(const char *, char * const *, char * const *); +int execvP(const char *, const char *, char * const *); +char *fflagstostr(u_long); +int getdomainname(char *, int); +int getgrouplist(const char *, gid_t, gid_t *, int *); +mode_t getmode(const void *, mode_t); +int getpeereid(int, uid_t *, gid_t *); +int getresgid(gid_t *, gid_t *, gid_t *); +int getresuid(uid_t *, uid_t *, uid_t *); +char *getusershell(void); +int initgroups(const char *, gid_t); +int iruserok(unsigned long, int, const char *, const char *); +int iruserok_sa(const void *, int, int, const char *, const char *); +int issetugid(void); +char *mkdtemp(char *); +#ifndef _MKNOD_DECLARED +int mknod(const char *, mode_t, dev_t); +#define _MKNOD_DECLARED +#endif +#ifndef _MKSTEMP_DECLARED +int mkstemp(char *); +#define _MKSTEMP_DECLARED +#endif +int mkstemps(char *, int); +#ifndef _MKTEMP_DECLARED +char *mktemp(char *); +#define _MKTEMP_DECLARED +#endif +int nfssvc(int, void *); +int profil(char *, size_t, vm_offset_t, int); +int rcmd(char **, int, const char *, const char *, const char *, int *); +int rcmd_af(char **, int, const char *, + const char *, const char *, int *, int); +int rcmdsh(char **, int, const char *, + const char *, const char *, const char *); +char *re_comp(const char *); +int re_exec(const char *); +int reboot(int); +int revoke(const char *); +pid_t rfork(int); +pid_t rfork_thread(int, void *, int (*)(void *), void *); +int rresvport(int *); +int rresvport_af(int *, int); +int ruserok(const char *, int, const char *, const char *); +#if __BSD_VISIBLE +#ifndef _SELECT_DECLARED +#define _SELECT_DECLARED +int select(int, fd_set *, fd_set *, fd_set *, struct timeval *); +#endif +#endif +int setdomainname(const char *, int); +int setgroups(int, const gid_t *); +void sethostid(long); +int sethostname(const char *, int); +#ifndef _SETKEY_DECLARED +int setkey(const char *); +#define _SETKEY_DECLARED +#endif +int setlogin(const char *); +void *setmode(const char *); +int setresgid(gid_t, gid_t, gid_t); +int setresuid(uid_t, uid_t, uid_t); +int setrgid(gid_t); +int setruid(uid_t); +void setusershell(void); +int strtofflags(char **, u_long *, u_long *); +int swapon(const char *); +int swapoff(const char *); +int syscall(int, ...); +off_t __syscall(quad_t, ...); +int ttyslot(void); +int undelete(const char *); +int unwhiteout(const char *); +void *valloc(size_t); /* obsoleted by malloc() */ + +#ifndef _OPTRESET_DECLARED +#define _OPTRESET_DECLARED +extern int optreset; /* getopt(3) external variable */ +#endif +#endif /* __BSD_VISIBLE */ +__END_DECLS + +#endif /* !_UNISTD_H_ */ diff --git a/src/include.new/usbhid.h b/src/include.new/usbhid.h new file mode 100644 index 0000000..42e0b99 --- /dev/null +++ b/src/include.new/usbhid.h @@ -0,0 +1,109 @@ +/* $NetBSD: usb.h,v 1.8 2000/08/13 22:22:02 augustss Exp $ */ + +/* + * Copyright (c) 1999 Lennart Augustsson + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD: src/lib/libusbhid/usbhid.h,v 1.11 2004/06/03 15:04:24 des Exp $ + * + */ + +#include + +typedef struct report_desc *report_desc_t; + +typedef struct hid_data *hid_data_t; + +typedef enum hid_kind { + hid_input = 0, + hid_output = 1, + hid_feature = 2, + hid_collection, + hid_endcollection +} hid_kind_t; + +typedef struct hid_item { + /* Global */ + unsigned int _usage_page; + int logical_minimum; + int logical_maximum; + int physical_minimum; + int physical_maximum; + int unit_exponent; + int unit; + int report_size; + int report_ID; +#define NO_REPORT_ID 0 + int report_count; + /* Local */ + unsigned int usage; + int usage_minimum; + int usage_maximum; + int designator_index; + int designator_minimum; + int designator_maximum; + int string_index; + int string_minimum; + int string_maximum; + int set_delimiter; + /* Misc */ + int collection; + int collevel; + enum hid_kind kind; + unsigned int flags; + /* Absolute data position (bits) */ + unsigned int pos; + /* */ + struct hid_item *next; +} hid_item_t; + +#define HID_PAGE(u) (((u) >> 16) & 0xffff) +#define HID_USAGE(u) ((u) & 0xffff) + +__BEGIN_DECLS + +/* Obtaining a report descriptor, descr.c: */ +report_desc_t hid_get_report_desc(int file); +report_desc_t hid_use_report_desc(unsigned char *data, unsigned int size); +void hid_dispose_report_desc(report_desc_t); + +/* Parsing of a HID report descriptor, parse.c: */ +hid_data_t hid_start_parse(report_desc_t d, int kindset, int id); +void hid_end_parse(hid_data_t s); +int hid_get_item(hid_data_t s, hid_item_t *h); +int hid_report_size(report_desc_t d, enum hid_kind k, int id); +int hid_locate(report_desc_t d, unsigned int usage, enum hid_kind k, hid_item_t *h, int id); + +/* Conversion to/from usage names, usage.c: */ +const char *hid_usage_page(int i); +const char *hid_usage_in_page(unsigned int u); +void hid_init(const char *file); +int hid_parse_usage_in_page(const char *name); +int hid_parse_usage_page(const char *name); + +/* Extracting/insertion of data, data.c: */ +int hid_get_data(const void *p, const hid_item_t *h); +void hid_set_data(void *p, const hid_item_t *h, int data); + +__END_DECLS diff --git a/src/include.new/utime.h b/src/include.new/utime.h new file mode 100644 index 0000000..ded805a --- /dev/null +++ b/src/include.new/utime.h @@ -0,0 +1,57 @@ +/*- + * Copyright (c) 1990, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)utime.h 8.1 (Berkeley) 6/2/93 + * $FreeBSD: src/include/utime.h,v 1.5 2002/08/24 00:11:52 mike Exp $ + */ + +#ifndef _UTIME_H_ +#define _UTIME_H_ + +#include +#include + +#ifndef _TIME_T_DECLARED +typedef __time_t time_t; +#define _TIME_T_DECLARED +#endif + +struct utimbuf { + time_t actime; /* Access time */ + time_t modtime; /* Modification time */ +}; + +__BEGIN_DECLS +int utime(const char *, const struct utimbuf *); +__END_DECLS + +#endif /* !_UTIME_H_ */ diff --git a/src/include.new/utmp.h b/src/include.new/utmp.h new file mode 100644 index 0000000..fdd9acc --- /dev/null +++ b/src/include.new/utmp.h @@ -0,0 +1,66 @@ +/* + * Copyright (c) 1988, 1993 + * The Regents of the University of California. All rights reserved. + * (c) UNIX System Laboratories, Inc. + * All or some portions of this file are derived from material licensed + * to the University of California by American Telephone and Telegraph + * Co. or Unix System Laboratories, Inc. and are reproduced herein with + * the permission of UNIX System Laboratories, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)utmp.h 8.2 (Berkeley) 1/21/94 + * $FreeBSD: src/include/utmp.h,v 1.10 2001/10/27 20:40:54 peter Exp $ + */ + +#ifndef _UTMP_H_ +#define _UTMP_H_ + +#define _PATH_UTMP "/var/run/utmp" +#define _PATH_WTMP "/var/log/wtmp" +#define _PATH_LASTLOG "/var/log/lastlog" + +#define UT_NAMESIZE 16 /* see MAXLOGNAME in */ +#define UT_LINESIZE 8 +#define UT_HOSTSIZE 16 + +struct lastlog { + int32_t ll_time; + char ll_line[UT_LINESIZE]; + char ll_host[UT_HOSTSIZE]; +}; + +struct utmp { + char ut_line[UT_LINESIZE]; + char ut_name[UT_NAMESIZE]; + char ut_host[UT_HOSTSIZE]; + int32_t ut_time; +}; + +#endif /* !_UTMP_H_ */ diff --git a/src/include.new/uuid.h b/src/include.new/uuid.h new file mode 100644 index 0000000..634f5b2 --- /dev/null +++ b/src/include.new/uuid.h @@ -0,0 +1,59 @@ +/*- + * Copyright (c) 2002,2005 Marcel Moolenaar + * Copyright (c) 2002 Hiten Mahesh Pandya + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD: src/include/uuid.h,v 1.3 2005/01/03 02:56:15 marcel Exp $ + */ + +#ifndef _UUID_H_ +#define _UUID_H_ + +#include +#include + +/* + * This implementation mostly conforms to the DCE 1.1 specification. + * See Also: + * uuidgen(1), uuidgen(2), uuid(3) + */ + +/* Status codes returned by the functions. */ +#define uuid_s_ok 0 +#define uuid_s_bad_version 1 +#define uuid_s_invalid_string_uuid 2 +#define uuid_s_no_memory 3 + +__BEGIN_DECLS +int32_t uuid_compare(const uuid_t *, const uuid_t *, uint32_t *); +void uuid_create(uuid_t *, uint32_t *); +void uuid_create_nil(uuid_t *, uint32_t *); +int32_t uuid_equal(const uuid_t *, const uuid_t *, uint32_t *); +void uuid_from_string(const char *, uuid_t *, uint32_t *); +uint16_t uuid_hash(const uuid_t *, uint32_t *); +int32_t uuid_is_nil(const uuid_t *, uint32_t *); +void uuid_to_string(const uuid_t *, char **, uint32_t *); +__END_DECLS + +#endif /* _UUID_H_ */ diff --git a/src/include.new/varargs.h b/src/include.new/varargs.h new file mode 100644 index 0000000..cd5444f --- /dev/null +++ b/src/include.new/varargs.h @@ -0,0 +1,43 @@ +/*- + * Copyright (c) 2003 Alexander Kabaev + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD: src/include/varargs.h,v 1.1 2003/09/01 03:28:25 kan Exp $ + */ + +#ifndef _VARARGS_H_ +#define _VARARGS_H_ + +#if defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ > 2 || __GNUC__ >= 4) + +#error " is obsolete with this version of GCC." +#error "Change your code to use instead." + +#else /* ! __GNUC__ post GCC 3.3 */ + +#include + +#endif /* __GNUC__ post GCC 3.3 */ + +#endif /* !_VARARGS_H_ */ diff --git a/src/include.new/vgl.h b/src/include.new/vgl.h new file mode 100644 index 0000000..24a5c38 --- /dev/null +++ b/src/include.new/vgl.h @@ -0,0 +1,154 @@ +/*- + * Copyright (c) 1991-1997 S�ren Schmidt + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer + * in this position and unchanged. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * $FreeBSD: src/lib/libvgl/vgl.h,v 1.8 2002/06/02 20:05:39 schweikh Exp $ + */ + +#ifndef _VGL_H_ +#define _VGL_H_ + +#include +#include +#include +#include + +typedef unsigned char byte; +typedef struct { + byte Type; + int Xsize, Ysize; + int VXsize, VYsize; + int Xorigin, Yorigin; + byte *Bitmap; + int PixelBytes; +} VGLBitmap; + +#define VGLBITMAP_INITIALIZER(t, x, y, bits) \ + { (t), (x), (y), (x), (y), 0, 0, (bits) } + +/* + * Defined Type's + */ +#define MEMBUF 0 +#define VIDBUF4 1 +#define VIDBUF8 2 +#define VIDBUF8X 3 +#define VIDBUF8S 4 +#define VIDBUF4S 5 +#define VIDBUF16 6 /* Direct Color linear buffer */ +#define VIDBUF24 7 /* Direct Color linear buffer */ +#define VIDBUF32 8 /* Direct Color linear buffer */ +#define VIDBUF16S 9 /* Direct Color segmented buffer */ +#define VIDBUF24S 10 /* Direct Color segmented buffer */ +#define VIDBUF32S 11 /* Direct Color segmented buffer */ +#define NOBUF 255 + +typedef struct VGLText { + byte Width, Height; + byte *BitmapArray; +} VGLText; + +typedef struct VGLObject { + int Id; + int Type; + int Status; + int Xpos, Ypos; + int Xhot, Yhot; + VGLBitmap *Image; + VGLBitmap *Mask; + int (*CallBackFunction)(); +} VGLObject; + +#define MOUSE_IMG_SIZE 16 +#define VGL_MOUSEHIDE 0 +#define VGL_MOUSESHOW 1 +#define VGL_MOUSEFREEZE 0 +#define VGL_MOUSEUNFREEZE 1 +#define VGL_DIR_RIGHT 0 +#define VGL_DIR_UP 1 +#define VGL_DIR_LEFT 2 +#define VGL_DIR_DOWN 3 +#define VGL_RAWKEYS 1 +#define VGL_CODEKEYS 2 +#define VGL_XLATEKEYS 3 + +extern video_adapter_info_t VGLAdpInfo; +extern video_info_t VGLModeInfo; +extern VGLBitmap *VGLDisplay; +extern byte *VGLBuf; + +/* + * Prototypes + */ +/* bitmap.c */ +int __VGLBitmapCopy(VGLBitmap *src, int srcx, int srcy, VGLBitmap *dst, int dstx, int dsty, int width, int hight); +int VGLBitmapCopy(VGLBitmap *src, int srcx, int srcy, VGLBitmap *dst, int dstx, int dsty, int width, int hight); +VGLBitmap *VGLBitmapCreate(int type, int xsize, int ysize, byte *bits); +void VGLBitmapDestroy(VGLBitmap *object); +int VGLBitmapAllocateBits(VGLBitmap *object); +/* keyboard.c */ +int VGLKeyboardInit(int mode); +void VGLKeyboardEnd(void); +int VGLKeyboardGetCh(void); +/* main.c */ +void VGLEnd(void); +int VGLInit(int mode); +void VGLCheckSwitch(void); +int VGLSetVScreenSize(VGLBitmap *object, int VXsize, int VYsize); +int VGLPanScreen(VGLBitmap *object, int x, int y); +int VGLSetSegment(unsigned int offset); +/* mouse.c */ +void VGLMousePointerShow(void); +void VGLMousePointerHide(void); +void VGLMouseMode(int mode); +void VGLMouseAction(int dummy); +void VGLMouseSetImage(VGLBitmap *AndMask, VGLBitmap *OrMask); +void VGLMouseSetStdImage(void); +int VGLMouseInit(int mode); +int VGLMouseStatus(int *x, int *y, char *buttons); +int VGLMouseFreeze(int x, int y, int width, int hight, byte color); +void VGLMouseUnFreeze(void); +/* simple.c */ +void VGLSetXY(VGLBitmap *object, int x, int y, u_long color); +u_long VGLGetXY(VGLBitmap *object, int x, int y); +void VGLLine(VGLBitmap *object, int x1, int y1, int x2, int y2, u_long color); +void VGLBox(VGLBitmap *object, int x1, int y1, int x2, int y2, u_long color); +void VGLFilledBox(VGLBitmap *object, int x1, int y1, int x2, int y2, u_long color); +void VGLEllipse(VGLBitmap *object, int xc, int yc, int a, int b, u_long color); +void VGLFilledEllipse(VGLBitmap *object, int xc, int yc, int a, int b, u_long color); +void VGLClear(VGLBitmap *object, u_long color); +void VGLRestorePalette(void); +void VGLSavePalette(void); +void VGLSetPalette(byte *red, byte *green, byte *blue); +void VGLSetPaletteIndex(byte color, byte red, byte green, byte blue); +void VGLSetBorder(byte color); +void VGLBlankDisplay(int blank); +/* text.c */ +int VGLTextSetFontFile(char *filename); +void VGLBitmapPutChar(VGLBitmap *Object, int x, int y, byte ch, byte fgcol, byte bgcol, int fill, int dir); +void VGLBitmapString(VGLBitmap *Object, int x, int y, char *str, byte fgcol, byte bgcol, int fill, int dir); + +#endif /* !_VGL_H_ */ diff --git a/src/include.new/vis.h b/src/include.new/vis.h new file mode 100644 index 0000000..f06cfba --- /dev/null +++ b/src/include.new/vis.h @@ -0,0 +1,95 @@ +/*- + * Copyright (c) 1990, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)vis.h 8.1 (Berkeley) 6/2/93 + * $FreeBSD: src/include/vis.h,v 1.11 2003/10/30 10:40:49 phk Exp $ + */ + +#ifndef _VIS_H_ +#define _VIS_H_ + +#include + +#ifndef _SIZE_T_DECLARED +typedef __size_t size_t; +#define _SIZE_T_DECLARED +#endif + +/* + * to select alternate encoding format + */ +#define VIS_OCTAL 0x01 /* use octal \ddd format */ +#define VIS_CSTYLE 0x02 /* use \[nrft0..] where appropriate */ + +/* + * to alter set of characters encoded (default is to encode all + * non-graphic except space, tab, and newline). + */ +#define VIS_SP 0x04 /* also encode space */ +#define VIS_TAB 0x08 /* also encode tab */ +#define VIS_NL 0x10 /* also encode newline */ +#define VIS_WHITE (VIS_SP | VIS_TAB | VIS_NL) +#define VIS_SAFE 0x20 /* only encode "unsafe" characters */ + +/* + * other + */ +#define VIS_NOSLASH 0x40 /* inhibit printing '\' */ +#define VIS_HTTPSTYLE 0x80 /* http-style escape % HEX HEX */ +#define VIS_GLOB 0x100 /* encode glob(3) magics */ + +/* + * unvis return codes + */ +#define UNVIS_VALID 1 /* character valid */ +#define UNVIS_VALIDPUSH 2 /* character valid, push back passed char */ +#define UNVIS_NOCHAR 3 /* valid sequence, no character produced */ +#define UNVIS_SYNBAD -1 /* unrecognized escape sequence */ +#define UNVIS_ERROR -2 /* decoder in unknown state (unrecoverable) */ + +/* + * unvis flags + */ +#define UNVIS_END 1 /* no more characters */ + +#include + +__BEGIN_DECLS +char *vis(char *, int, int, int); +int strvis(char *, const char *, int); +int strvisx(char *, const char *, size_t, int); +int strunvis(char *, const char *); +int strunvisx(char *, const char *, int); +int unvis(char *, int, int *, int); +__END_DECLS + +#endif /* !_VIS_H_ */ diff --git a/src/include.new/wchar.h b/src/include.new/wchar.h new file mode 100644 index 0000000..87bc16e --- /dev/null +++ b/src/include.new/wchar.h @@ -0,0 +1,224 @@ +/*- + * Copyright (c)1999 Citrus Project, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD: src/include/wchar.h,v 1.45 2004/08/12 12:19:10 tjr Exp $ + */ + +/*- + * Copyright (c) 1999, 2000 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Julian Coleman. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the NetBSD + * Foundation, Inc. and its contributors. + * 4. Neither the name of The NetBSD Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * $NetBSD: wchar.h,v 1.8 2000/12/22 05:31:42 itojun Exp $ + */ + +#ifndef _WCHAR_H_ +#define _WCHAR_H_ + +#include +#include +#include +#include +#include <_ctype.h> + +#ifndef _MBSTATE_T_DECLARED +typedef __mbstate_t mbstate_t; +#define _MBSTATE_T_DECLARED +#endif + +#ifndef _SIZE_T_DECLARED +typedef __size_t size_t; +#define _SIZE_T_DECLARED +#endif + +#ifndef __cplusplus +#ifndef _WCHAR_T_DECLARED +typedef __wchar_t wchar_t; +#define _WCHAR_T_DECLARED +#endif +#endif + +#ifndef _WINT_T_DECLARED +typedef __wint_t wint_t; +#define _WINT_T_DECLARED +#endif + +#ifndef WCHAR_MIN +#define WCHAR_MIN __INT_MIN +#define WCHAR_MAX __INT_MAX +#endif + +#ifndef WEOF +#define WEOF ((wint_t)-1) +#endif + +struct __sFILE; +struct tm; + +__BEGIN_DECLS +wint_t btowc(int); +wint_t fgetwc(struct __sFILE *); +wchar_t * + fgetws(wchar_t * __restrict, int, struct __sFILE * __restrict); +wint_t fputwc(wchar_t, struct __sFILE *); +int fputws(const wchar_t * __restrict, struct __sFILE * __restrict); +int fwide(struct __sFILE *, int); +int fwprintf(struct __sFILE * __restrict, const wchar_t * __restrict, ...); +int fwscanf(struct __sFILE * __restrict, const wchar_t * __restrict, ...); +wint_t getwc(struct __sFILE *); +wint_t getwchar(void); +size_t mbrlen(const char * __restrict, size_t, mbstate_t * __restrict); +size_t mbrtowc(wchar_t * __restrict, const char * __restrict, size_t, + mbstate_t * __restrict); +int mbsinit(const mbstate_t *); +size_t mbsrtowcs(wchar_t * __restrict, const char ** __restrict, size_t, + mbstate_t * __restrict); +wint_t putwc(wchar_t, struct __sFILE *); +wint_t putwchar(wchar_t); +int swprintf(wchar_t * __restrict, size_t n, const wchar_t * __restrict, + ...); +int swscanf(const wchar_t * __restrict, const wchar_t * __restrict, ...); +wint_t ungetwc(wint_t, struct __sFILE *); +int vfwprintf(struct __sFILE * __restrict, const wchar_t * __restrict, + __va_list); +int vswprintf(wchar_t * __restrict, size_t n, const wchar_t * __restrict, + __va_list); +int vwprintf(const wchar_t * __restrict, __va_list); +size_t wcrtomb(char * __restrict, wchar_t, mbstate_t * __restrict); +wchar_t *wcscat(wchar_t * __restrict, const wchar_t * __restrict); +wchar_t *wcschr(const wchar_t *, wchar_t) __pure; +int wcscmp(const wchar_t *, const wchar_t *) __pure; +int wcscoll(const wchar_t *, const wchar_t *); +wchar_t *wcscpy(wchar_t * __restrict, const wchar_t * __restrict); +size_t wcscspn(const wchar_t *, const wchar_t *) __pure; +size_t wcsftime(wchar_t * __restrict, size_t, const wchar_t * __restrict, + const struct tm * __restrict); +size_t wcslen(const wchar_t *) __pure; +wchar_t *wcsncat(wchar_t * __restrict, const wchar_t * __restrict, + size_t); +int wcsncmp(const wchar_t *, const wchar_t *, size_t) __pure; +wchar_t *wcsncpy(wchar_t * __restrict , const wchar_t * __restrict, size_t); +wchar_t *wcspbrk(const wchar_t *, const wchar_t *) __pure; +wchar_t *wcsrchr(const wchar_t *, wchar_t) __pure; +size_t wcsrtombs(char * __restrict, const wchar_t ** __restrict, size_t, + mbstate_t * __restrict); +size_t wcsspn(const wchar_t *, const wchar_t *) __pure; +wchar_t *wcsstr(const wchar_t * __restrict, const wchar_t * __restrict) + __pure; +size_t wcsxfrm(wchar_t * __restrict, const wchar_t * __restrict, size_t); +int wctob(wint_t); +double wcstod(const wchar_t * __restrict, wchar_t ** __restrict); +wchar_t *wcstok(wchar_t * __restrict, const wchar_t * __restrict, + wchar_t ** __restrict); +long wcstol(const wchar_t * __restrict, wchar_t ** __restrict, int); +unsigned long + wcstoul(const wchar_t * __restrict, wchar_t ** __restrict, int); +wchar_t *wmemchr(const wchar_t *, wchar_t, size_t) __pure; +int wmemcmp(const wchar_t *, const wchar_t *, size_t) __pure; +wchar_t *wmemcpy(wchar_t * __restrict, const wchar_t * __restrict, size_t); +wchar_t *wmemmove(wchar_t *, const wchar_t *, size_t); +wchar_t *wmemset(wchar_t *, wchar_t, size_t); +int wprintf(const wchar_t * __restrict, ...); +int wscanf(const wchar_t * __restrict, ...); + +#ifndef _STDSTREAM_DECLARED +extern struct __sFILE *__stdinp; +extern struct __sFILE *__stdoutp; +extern struct __sFILE *__stderrp; +#define _STDSTREAM_DECLARED +#endif + +#define getwc(fp) fgetwc(fp) +#define getwchar() fgetwc(__stdinp) +#define putwc(wc, fp) fputwc(wc, fp) +#define putwchar(wc) fputwc(wc, __stdoutp) + +#if __ISO_C_VISIBLE >= 1999 +int vfwscanf(struct __sFILE * __restrict, const wchar_t * __restrict, + __va_list); +int vswscanf(const wchar_t * __restrict, const wchar_t * __restrict, + __va_list); +int vwscanf(const wchar_t * __restrict, __va_list); +float wcstof(const wchar_t * __restrict, wchar_t ** __restrict); +long double + wcstold(const wchar_t * __restrict, wchar_t ** __restrict); +#ifdef __LONG_LONG_SUPPORTED +/* LONGLONG */ +long long + wcstoll(const wchar_t * __restrict, wchar_t ** __restrict, int); +/* LONGLONG */ +unsigned long long + wcstoull(const wchar_t * __restrict, wchar_t ** __restrict, int); +#endif +#endif /* __ISO_C_VISIBLE >= 1999 */ + +#if __XSI_VISIBLE +int wcswidth(const wchar_t *, size_t); +int wcwidth(wchar_t); +#define wcwidth(_c) __wcwidth(_c) +#endif + +#if __BSD_VISIBLE +wchar_t *fgetwln(struct __sFILE * __restrict, size_t * __restrict); +size_t mbsnrtowcs(wchar_t * __restrict, const char ** __restrict, size_t, + size_t, mbstate_t * __restrict); +size_t wcsnrtombs(char * __restrict, const wchar_t ** __restrict, size_t, + size_t, mbstate_t * __restrict); +size_t wcslcat(wchar_t *, const wchar_t *, size_t); +size_t wcslcpy(wchar_t *, const wchar_t *, size_t); +#endif +__END_DECLS + +#endif /* !_WCHAR_H_ */ diff --git a/src/include.new/wctype.h b/src/include.new/wctype.h new file mode 100644 index 0000000..2372176 --- /dev/null +++ b/src/include.new/wctype.h @@ -0,0 +1,118 @@ +/*- + * Copyright (c)1999 Citrus Project, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * citrus Id: wctype.h,v 1.4 2000/12/21 01:50:21 itojun Exp + * $NetBSD: wctype.h,v 1.3 2000/12/22 14:16:16 itojun Exp $ + * $FreeBSD: src/include/wctype.h,v 1.13 2004/08/12 10:29:14 tjr Exp $ + */ + +#ifndef _WCTYPE_H_ +#define _WCTYPE_H_ + +#include +#include + +#include <_ctype.h> + +#ifndef _WCTRANS_T +typedef int wctrans_t; +#define _WCTRANS_T +#endif + +#ifndef _WCTYPE_T +typedef unsigned long wctype_t; +#define _WCTYPE_T +#endif + +#ifndef _WINT_T_DECLARED +typedef __wint_t wint_t; +#define _WINT_T_DECLARED +#endif + +#ifndef WEOF +#define WEOF ((wint_t)-1) +#endif + +__BEGIN_DECLS +int iswalnum(wint_t); +int iswalpha(wint_t); +int iswblank(wint_t); +int iswcntrl(wint_t); +int iswctype(wint_t, wctype_t); +int iswdigit(wint_t); +int iswgraph(wint_t); +int iswlower(wint_t); +int iswprint(wint_t); +int iswpunct(wint_t); +int iswspace(wint_t); +int iswupper(wint_t); +int iswxdigit(wint_t); +wint_t towctrans(wint_t, wctrans_t); +wint_t towlower(wint_t); +wint_t towupper(wint_t); +wctrans_t + wctrans(const char *); +wctype_t + wctype(const char *); + +#if __BSD_VISIBLE +wint_t iswascii(wint_t); +wint_t iswhexnumber(wint_t); +wint_t iswideogram(wint_t); +wint_t iswnumber(wint_t); +wint_t iswphonogram(wint_t); +wint_t iswrune(wint_t); +wint_t iswspecial(wint_t); +wint_t nextwctype(wint_t, wctype_t); +#endif +__END_DECLS + +#define iswalnum(wc) __istype((wc), _CTYPE_A|_CTYPE_D) +#define iswalpha(wc) __istype((wc), _CTYPE_A) +#define iswblank(wc) __istype((wc), _CTYPE_B) +#define iswcntrl(wc) __istype((wc), _CTYPE_C) +#define iswctype(wc, charclass) __istype((wc), (charclass)) +#define iswdigit(wc) __isctype((wc), _CTYPE_D) +#define iswgraph(wc) __istype((wc), _CTYPE_G) +#define iswlower(wc) __istype((wc), _CTYPE_L) +#define iswprint(wc) __istype((wc), _CTYPE_R) +#define iswpunct(wc) __istype((wc), _CTYPE_P) +#define iswspace(wc) __istype((wc), _CTYPE_S) +#define iswupper(wc) __istype((wc), _CTYPE_U) +#define iswxdigit(wc) __isctype((wc), _CTYPE_X) +#define towlower(wc) __tolower(wc) +#define towupper(wc) __toupper(wc) + +#if __BSD_VISIBLE +#define iswascii(wc) (((wc) & ~0x7F) == 0) +#define iswhexnumber(wc) __istype((wc), _CTYPE_X) +#define iswideogram(wc) __istype((wc), _CTYPE_I) +#define iswnumber(wc) __istype((wc), _CTYPE_D) +#define iswphonogram(wc) __istype((wc), _CTYPE_Q) +#define iswrune(wc) __istype((wc), 0xFFFFFF00L) +#define iswspecial(wc) __istype((wc), _CTYPE_T) +#endif + +#endif /* _WCTYPE_H_ */ diff --git a/src/include.new/wordexp.h b/src/include.new/wordexp.h new file mode 100644 index 0000000..1a41e35 --- /dev/null +++ b/src/include.new/wordexp.h @@ -0,0 +1,75 @@ +/*- + * Copyright (c) 2002 Tim J. Robbins. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD: src/include/wordexp.h,v 1.5 2004/06/30 13:55:08 tjr Exp $ + */ + +#ifndef _WORDEXP_H_ +#define _WORDEXP_H_ + +#include +#include + +#if __XSI_VISIBLE && !defined(_SIZE_T_DECLARED) +typedef __size_t size_t; +#define _SIZE_T_DECLARED +#endif + +typedef struct { + __size_t we_wordc; /* count of words matched */ + char **we_wordv; /* pointer to list of words */ + __size_t we_offs; /* slots to reserve in we_wordv */ + char *we_strings; /* storage for wordv strings */ + __size_t we_nbytes; /* size of we_strings */ +} wordexp_t; + +/* + * Flags for wordexp(). + */ +#define WRDE_APPEND 0x1 /* append to previously generated */ +#define WRDE_DOOFFS 0x2 /* we_offs member is valid */ +#define WRDE_NOCMD 0x4 /* disallow command substitution */ +#define WRDE_REUSE 0x8 /* reuse wordexp_t */ +#define WRDE_SHOWERR 0x10 /* don't redirect stderr to /dev/null */ +#define WRDE_UNDEF 0x20 /* disallow undefined shell vars */ + +/* + * Return values from wordexp(). + */ +#define WRDE_BADCHAR 1 /* unquoted special character */ +#define WRDE_BADVAL 2 /* undefined variable */ +#define WRDE_CMDSUB 3 /* command substitution not allowed */ +#define WRDE_NOSPACE 4 /* no memory for result */ +#if __XSI_VISIBLE +#define WRDE_NOSYS 5 /* obsolete, reserved */ +#endif +#define WRDE_SYNTAX 6 /* shell syntax error */ + +__BEGIN_DECLS +int wordexp(const char * __restrict, wordexp_t * __restrict, int); +void wordfree(wordexp_t *); +__END_DECLS + +#endif /* !_WORDEXP_H_ */ diff --git a/src/include.new/xmmintrin.h b/src/include.new/xmmintrin.h new file mode 100644 index 0000000..921806f --- /dev/null +++ b/src/include.new/xmmintrin.h @@ -0,0 +1,1219 @@ +/* Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc. + + This file is part of GCC. + + GCC is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + GCC is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with GCC; see the file COPYING. If not, write to + the Free Software Foundation, 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +/* As a special exception, if you include this header file into source + files compiled by GCC, this header file does not by itself cause + the resulting executable to be covered by the GNU General Public + License. This exception does not however invalidate any other + reasons why the executable file might be covered by the GNU General + Public License. */ + +/* Implemented from the specification included in the Intel C++ Compiler + User Guide and Reference, version 8.0. */ + +#ifndef _XMMINTRIN_H_INCLUDED +#define _XMMINTRIN_H_INCLUDED + +#ifndef __SSE__ +# error "SSE instruction set not enabled" +#else + +/* We need type definitions from the MMX header file. */ +#include + +/* The data type intended for user use. */ +typedef float __m128 __attribute__ ((__mode__(__V4SF__))); + +/* Internal data types for implementing the intrinsics. */ +typedef float __v4sf __attribute__ ((__mode__(__V4SF__))); + +/* Create a selector for use with the SHUFPS instruction. */ +#define _MM_SHUFFLE(fp3,fp2,fp1,fp0) \ + (((fp3) << 6) | ((fp2) << 4) | ((fp1) << 2) | (fp0)) + +/* Constants for use with _mm_prefetch. */ +enum _mm_hint +{ + _MM_HINT_T0 = 3, + _MM_HINT_T1 = 2, + _MM_HINT_T2 = 1, + _MM_HINT_NTA = 0 +}; + +/* Bits in the MXCSR. */ +#define _MM_EXCEPT_MASK 0x003f +#define _MM_EXCEPT_INVALID 0x0001 +#define _MM_EXCEPT_DENORM 0x0002 +#define _MM_EXCEPT_DIV_ZERO 0x0004 +#define _MM_EXCEPT_OVERFLOW 0x0008 +#define _MM_EXCEPT_UNDERFLOW 0x0010 +#define _MM_EXCEPT_INEXACT 0x0020 + +#define _MM_MASK_MASK 0x1f80 +#define _MM_MASK_INVALID 0x0080 +#define _MM_MASK_DENORM 0x0100 +#define _MM_MASK_DIV_ZERO 0x0200 +#define _MM_MASK_OVERFLOW 0x0400 +#define _MM_MASK_UNDERFLOW 0x0800 +#define _MM_MASK_INEXACT 0x1000 + +#define _MM_ROUND_MASK 0x6000 +#define _MM_ROUND_NEAREST 0x0000 +#define _MM_ROUND_DOWN 0x2000 +#define _MM_ROUND_UP 0x4000 +#define _MM_ROUND_TOWARD_ZERO 0x6000 + +#define _MM_FLUSH_ZERO_MASK 0x8000 +#define _MM_FLUSH_ZERO_ON 0x8000 +#define _MM_FLUSH_ZERO_OFF 0x0000 + +/* Perform the respective operation on the lower SPFP (single-precision + floating-point) values of A and B; the upper three SPFP values are + passed through from A. */ + +static __inline __m128 +_mm_add_ss (__m128 __A, __m128 __B) +{ + return (__m128) __builtin_ia32_addss ((__v4sf)__A, (__v4sf)__B); +} + +static __inline __m128 +_mm_sub_ss (__m128 __A, __m128 __B) +{ + return (__m128) __builtin_ia32_subss ((__v4sf)__A, (__v4sf)__B); +} + +static __inline __m128 +_mm_mul_ss (__m128 __A, __m128 __B) +{ + return (__m128) __builtin_ia32_mulss ((__v4sf)__A, (__v4sf)__B); +} + +static __inline __m128 +_mm_div_ss (__m128 __A, __m128 __B) +{ + return (__m128) __builtin_ia32_divss ((__v4sf)__A, (__v4sf)__B); +} + +static __inline __m128 +_mm_sqrt_ss (__m128 __A) +{ + return (__m128) __builtin_ia32_sqrtss ((__v4sf)__A); +} + +static __inline __m128 +_mm_rcp_ss (__m128 __A) +{ + return (__m128) __builtin_ia32_rcpss ((__v4sf)__A); +} + +static __inline __m128 +_mm_rsqrt_ss (__m128 __A) +{ + return (__m128) __builtin_ia32_rsqrtss ((__v4sf)__A); +} + +static __inline __m128 +_mm_min_ss (__m128 __A, __m128 __B) +{ + return (__m128) __builtin_ia32_minss ((__v4sf)__A, (__v4sf)__B); +} + +static __inline __m128 +_mm_max_ss (__m128 __A, __m128 __B) +{ + return (__m128) __builtin_ia32_maxss ((__v4sf)__A, (__v4sf)__B); +} + +/* Perform the respective operation on the four SPFP values in A and B. */ + +static __inline __m128 +_mm_add_ps (__m128 __A, __m128 __B) +{ + return (__m128) __builtin_ia32_addps ((__v4sf)__A, (__v4sf)__B); +} + +static __inline __m128 +_mm_sub_ps (__m128 __A, __m128 __B) +{ + return (__m128) __builtin_ia32_subps ((__v4sf)__A, (__v4sf)__B); +} + +static __inline __m128 +_mm_mul_ps (__m128 __A, __m128 __B) +{ + return (__m128) __builtin_ia32_mulps ((__v4sf)__A, (__v4sf)__B); +} + +static __inline __m128 +_mm_div_ps (__m128 __A, __m128 __B) +{ + return (__m128) __builtin_ia32_divps ((__v4sf)__A, (__v4sf)__B); +} + +static __inline __m128 +_mm_sqrt_ps (__m128 __A) +{ + return (__m128) __builtin_ia32_sqrtps ((__v4sf)__A); +} + +static __inline __m128 +_mm_rcp_ps (__m128 __A) +{ + return (__m128) __builtin_ia32_rcpps ((__v4sf)__A); +} + +static __inline __m128 +_mm_rsqrt_ps (__m128 __A) +{ + return (__m128) __builtin_ia32_rsqrtps ((__v4sf)__A); +} + +static __inline __m128 +_mm_min_ps (__m128 __A, __m128 __B) +{ + return (__m128) __builtin_ia32_minps ((__v4sf)__A, (__v4sf)__B); +} + +static __inline __m128 +_mm_max_ps (__m128 __A, __m128 __B) +{ + return (__m128) __builtin_ia32_maxps ((__v4sf)__A, (__v4sf)__B); +} + +/* Perform logical bit-wise operations on 128-bit values. */ + +static __inline __m128 +_mm_and_ps (__m128 __A, __m128 __B) +{ + return __builtin_ia32_andps (__A, __B); +} + +static __inline __m128 +_mm_andnot_ps (__m128 __A, __m128 __B) +{ + return __builtin_ia32_andnps (__A, __B); +} + +static __inline __m128 +_mm_or_ps (__m128 __A, __m128 __B) +{ + return __builtin_ia32_orps (__A, __B); +} + +static __inline __m128 +_mm_xor_ps (__m128 __A, __m128 __B) +{ + return __builtin_ia32_xorps (__A, __B); +} + +/* Perform a comparison on the lower SPFP values of A and B. If the + comparison is true, place a mask of all ones in the result, otherwise a + mask of zeros. The upper three SPFP values are passed through from A. */ + +static __inline __m128 +_mm_cmpeq_ss (__m128 __A, __m128 __B) +{ + return (__m128) __builtin_ia32_cmpeqss ((__v4sf)__A, (__v4sf)__B); +} + +static __inline __m128 +_mm_cmplt_ss (__m128 __A, __m128 __B) +{ + return (__m128) __builtin_ia32_cmpltss ((__v4sf)__A, (__v4sf)__B); +} + +static __inline __m128 +_mm_cmple_ss (__m128 __A, __m128 __B) +{ + return (__m128) __builtin_ia32_cmpless ((__v4sf)__A, (__v4sf)__B); +} + +static __inline __m128 +_mm_cmpgt_ss (__m128 __A, __m128 __B) +{ + return (__m128) __builtin_ia32_movss ((__v4sf) __A, + (__v4sf) + __builtin_ia32_cmpltss ((__v4sf) __B, + (__v4sf) + __A)); +} + +static __inline __m128 +_mm_cmpge_ss (__m128 __A, __m128 __B) +{ + return (__m128) __builtin_ia32_movss ((__v4sf) __A, + (__v4sf) + __builtin_ia32_cmpless ((__v4sf) __B, + (__v4sf) + __A)); +} + +static __inline __m128 +_mm_cmpneq_ss (__m128 __A, __m128 __B) +{ + return (__m128) __builtin_ia32_cmpneqss ((__v4sf)__A, (__v4sf)__B); +} + +static __inline __m128 +_mm_cmpnlt_ss (__m128 __A, __m128 __B) +{ + return (__m128) __builtin_ia32_cmpnltss ((__v4sf)__A, (__v4sf)__B); +} + +static __inline __m128 +_mm_cmpnle_ss (__m128 __A, __m128 __B) +{ + return (__m128) __builtin_ia32_cmpnless ((__v4sf)__A, (__v4sf)__B); +} + +static __inline __m128 +_mm_cmpngt_ss (__m128 __A, __m128 __B) +{ + return (__m128) __builtin_ia32_movss ((__v4sf) __A, + (__v4sf) + __builtin_ia32_cmpnltss ((__v4sf) __B, + (__v4sf) + __A)); +} + +static __inline __m128 +_mm_cmpnge_ss (__m128 __A, __m128 __B) +{ + return (__m128) __builtin_ia32_movss ((__v4sf) __A, + (__v4sf) + __builtin_ia32_cmpnless ((__v4sf) __B, + (__v4sf) + __A)); +} + +static __inline __m128 +_mm_cmpord_ss (__m128 __A, __m128 __B) +{ + return (__m128) __builtin_ia32_cmpordss ((__v4sf)__A, (__v4sf)__B); +} + +static __inline __m128 +_mm_cmpunord_ss (__m128 __A, __m128 __B) +{ + return (__m128) __builtin_ia32_cmpunordss ((__v4sf)__A, (__v4sf)__B); +} + +/* Perform a comparison on the four SPFP values of A and B. For each + element, if the comparison is true, place a mask of all ones in the + result, otherwise a mask of zeros. */ + +static __inline __m128 +_mm_cmpeq_ps (__m128 __A, __m128 __B) +{ + return (__m128) __builtin_ia32_cmpeqps ((__v4sf)__A, (__v4sf)__B); +} + +static __inline __m128 +_mm_cmplt_ps (__m128 __A, __m128 __B) +{ + return (__m128) __builtin_ia32_cmpltps ((__v4sf)__A, (__v4sf)__B); +} + +static __inline __m128 +_mm_cmple_ps (__m128 __A, __m128 __B) +{ + return (__m128) __builtin_ia32_cmpleps ((__v4sf)__A, (__v4sf)__B); +} + +static __inline __m128 +_mm_cmpgt_ps (__m128 __A, __m128 __B) +{ + return (__m128) __builtin_ia32_cmpgtps ((__v4sf)__A, (__v4sf)__B); +} + +static __inline __m128 +_mm_cmpge_ps (__m128 __A, __m128 __B) +{ + return (__m128) __builtin_ia32_cmpgeps ((__v4sf)__A, (__v4sf)__B); +} + +static __inline __m128 +_mm_cmpneq_ps (__m128 __A, __m128 __B) +{ + return (__m128) __builtin_ia32_cmpneqps ((__v4sf)__A, (__v4sf)__B); +} + +static __inline __m128 +_mm_cmpnlt_ps (__m128 __A, __m128 __B) +{ + return (__m128) __builtin_ia32_cmpnltps ((__v4sf)__A, (__v4sf)__B); +} + +static __inline __m128 +_mm_cmpnle_ps (__m128 __A, __m128 __B) +{ + return (__m128) __builtin_ia32_cmpnleps ((__v4sf)__A, (__v4sf)__B); +} + +static __inline __m128 +_mm_cmpngt_ps (__m128 __A, __m128 __B) +{ + return (__m128) __builtin_ia32_cmpngtps ((__v4sf)__A, (__v4sf)__B); +} + +static __inline __m128 +_mm_cmpnge_ps (__m128 __A, __m128 __B) +{ + return (__m128) __builtin_ia32_cmpngeps ((__v4sf)__A, (__v4sf)__B); +} + +static __inline __m128 +_mm_cmpord_ps (__m128 __A, __m128 __B) +{ + return (__m128) __builtin_ia32_cmpordps ((__v4sf)__A, (__v4sf)__B); +} + +static __inline __m128 +_mm_cmpunord_ps (__m128 __A, __m128 __B) +{ + return (__m128) __builtin_ia32_cmpunordps ((__v4sf)__A, (__v4sf)__B); +} + +/* Compare the lower SPFP values of A and B and return 1 if true + and 0 if false. */ + +static __inline int +_mm_comieq_ss (__m128 __A, __m128 __B) +{ + return __builtin_ia32_comieq ((__v4sf)__A, (__v4sf)__B); +} + +static __inline int +_mm_comilt_ss (__m128 __A, __m128 __B) +{ + return __builtin_ia32_comilt ((__v4sf)__A, (__v4sf)__B); +} + +static __inline int +_mm_comile_ss (__m128 __A, __m128 __B) +{ + return __builtin_ia32_comile ((__v4sf)__A, (__v4sf)__B); +} + +static __inline int +_mm_comigt_ss (__m128 __A, __m128 __B) +{ + return __builtin_ia32_comigt ((__v4sf)__A, (__v4sf)__B); +} + +static __inline int +_mm_comige_ss (__m128 __A, __m128 __B) +{ + return __builtin_ia32_comige ((__v4sf)__A, (__v4sf)__B); +} + +static __inline int +_mm_comineq_ss (__m128 __A, __m128 __B) +{ + return __builtin_ia32_comineq ((__v4sf)__A, (__v4sf)__B); +} + +static __inline int +_mm_ucomieq_ss (__m128 __A, __m128 __B) +{ + return __builtin_ia32_ucomieq ((__v4sf)__A, (__v4sf)__B); +} + +static __inline int +_mm_ucomilt_ss (__m128 __A, __m128 __B) +{ + return __builtin_ia32_ucomilt ((__v4sf)__A, (__v4sf)__B); +} + +static __inline int +_mm_ucomile_ss (__m128 __A, __m128 __B) +{ + return __builtin_ia32_ucomile ((__v4sf)__A, (__v4sf)__B); +} + +static __inline int +_mm_ucomigt_ss (__m128 __A, __m128 __B) +{ + return __builtin_ia32_ucomigt ((__v4sf)__A, (__v4sf)__B); +} + +static __inline int +_mm_ucomige_ss (__m128 __A, __m128 __B) +{ + return __builtin_ia32_ucomige ((__v4sf)__A, (__v4sf)__B); +} + +static __inline int +_mm_ucomineq_ss (__m128 __A, __m128 __B) +{ + return __builtin_ia32_ucomineq ((__v4sf)__A, (__v4sf)__B); +} + +/* Convert the lower SPFP value to a 32-bit integer according to the current + rounding mode. */ +static __inline int +_mm_cvtss_si32 (__m128 __A) +{ + return __builtin_ia32_cvtss2si ((__v4sf) __A); +} + +static __inline int +_mm_cvt_ss2si (__m128 __A) +{ + return _mm_cvtss_si32 (__A); +} + +#ifdef __x86_64__ +/* Convert the lower SPFP value to a 32-bit integer according to the current + rounding mode. */ +static __inline long long +_mm_cvtss_si64x (__m128 __A) +{ + return __builtin_ia32_cvtss2si64 ((__v4sf) __A); +} +#endif + +/* Convert the two lower SPFP values to 32-bit integers according to the + current rounding mode. Return the integers in packed form. */ +static __inline __m64 +_mm_cvtps_pi32 (__m128 __A) +{ + return (__m64) __builtin_ia32_cvtps2pi ((__v4sf) __A); +} + +static __inline __m64 +_mm_cvt_ps2pi (__m128 __A) +{ + return _mm_cvtps_pi32 (__A); +} + +/* Truncate the lower SPFP value to a 32-bit integer. */ +static __inline int +_mm_cvttss_si32 (__m128 __A) +{ + return __builtin_ia32_cvttss2si ((__v4sf) __A); +} + +static __inline int +_mm_cvtt_ss2si (__m128 __A) +{ + return _mm_cvttss_si32 (__A); +} + +#ifdef __x86_64__ +/* Truncate the lower SPFP value to a 32-bit integer. */ +static __inline long long +_mm_cvttss_si64x (__m128 __A) +{ + return __builtin_ia32_cvttss2si64 ((__v4sf) __A); +} +#endif + +/* Truncate the two lower SPFP values to 32-bit integers. Return the + integers in packed form. */ +static __inline __m64 +_mm_cvttps_pi32 (__m128 __A) +{ + return (__m64) __builtin_ia32_cvttps2pi ((__v4sf) __A); +} + +static __inline __m64 +_mm_cvtt_ps2pi (__m128 __A) +{ + return _mm_cvttps_pi32 (__A); +} + +/* Convert B to a SPFP value and insert it as element zero in A. */ +static __inline __m128 +_mm_cvtsi32_ss (__m128 __A, int __B) +{ + return (__m128) __builtin_ia32_cvtsi2ss ((__v4sf) __A, __B); +} + +static __inline __m128 +_mm_cvt_si2ss (__m128 __A, int __B) +{ + return _mm_cvtsi32_ss (__A, __B); +} + +#ifdef __x86_64__ +/* Convert B to a SPFP value and insert it as element zero in A. */ +static __inline __m128 +_mm_cvtsi64x_ss (__m128 __A, long long __B) +{ + return (__m128) __builtin_ia32_cvtsi642ss ((__v4sf) __A, __B); +} +#endif + +/* Convert the two 32-bit values in B to SPFP form and insert them + as the two lower elements in A. */ +static __inline __m128 +_mm_cvtpi32_ps (__m128 __A, __m64 __B) +{ + return (__m128) __builtin_ia32_cvtpi2ps ((__v4sf) __A, (__v2si)__B); +} + +static __inline __m128 +_mm_cvt_pi2ps (__m128 __A, __m64 __B) +{ + return _mm_cvtpi32_ps (__A, __B); +} + +/* Convert the four signed 16-bit values in A to SPFP form. */ +static __inline __m128 +_mm_cvtpi16_ps (__m64 __A) +{ + __v4hi __sign; + __v2si __hisi, __losi; + __v4sf __r; + + /* This comparison against zero gives us a mask that can be used to + fill in the missing sign bits in the unpack operations below, so + that we get signed values after unpacking. */ + __sign = (__v4hi) __builtin_ia32_mmx_zero (); + __sign = __builtin_ia32_pcmpgtw (__sign, (__v4hi)__A); + + /* Convert the four words to doublewords. */ + __hisi = (__v2si) __builtin_ia32_punpckhwd ((__v4hi)__A, __sign); + __losi = (__v2si) __builtin_ia32_punpcklwd ((__v4hi)__A, __sign); + + /* Convert the doublewords to floating point two at a time. */ + __r = (__v4sf) __builtin_ia32_setzerops (); + __r = __builtin_ia32_cvtpi2ps (__r, __hisi); + __r = __builtin_ia32_movlhps (__r, __r); + __r = __builtin_ia32_cvtpi2ps (__r, __losi); + + return (__m128) __r; +} + +/* Convert the four unsigned 16-bit values in A to SPFP form. */ +static __inline __m128 +_mm_cvtpu16_ps (__m64 __A) +{ + __v4hi __zero = (__v4hi) __builtin_ia32_mmx_zero (); + __v2si __hisi, __losi; + __v4sf __r; + + /* Convert the four words to doublewords. */ + __hisi = (__v2si) __builtin_ia32_punpckhwd ((__v4hi)__A, __zero); + __losi = (__v2si) __builtin_ia32_punpcklwd ((__v4hi)__A, __zero); + + /* Convert the doublewords to floating point two at a time. */ + __r = (__v4sf) __builtin_ia32_setzerops (); + __r = __builtin_ia32_cvtpi2ps (__r, __hisi); + __r = __builtin_ia32_movlhps (__r, __r); + __r = __builtin_ia32_cvtpi2ps (__r, __losi); + + return (__m128) __r; +} + +/* Convert the low four signed 8-bit values in A to SPFP form. */ +static __inline __m128 +_mm_cvtpi8_ps (__m64 __A) +{ + __v8qi __sign; + + /* This comparison against zero gives us a mask that can be used to + fill in the missing sign bits in the unpack operations below, so + that we get signed values after unpacking. */ + __sign = (__v8qi) __builtin_ia32_mmx_zero (); + __sign = __builtin_ia32_pcmpgtb (__sign, (__v8qi)__A); + + /* Convert the four low bytes to words. */ + __A = (__m64) __builtin_ia32_punpcklbw ((__v8qi)__A, __sign); + + return _mm_cvtpi16_ps(__A); +} + +/* Convert the low four unsigned 8-bit values in A to SPFP form. */ +static __inline __m128 +_mm_cvtpu8_ps(__m64 __A) +{ + __v8qi __zero = (__v8qi) __builtin_ia32_mmx_zero (); + __A = (__m64) __builtin_ia32_punpcklbw ((__v8qi)__A, __zero); + return _mm_cvtpu16_ps(__A); +} + +/* Convert the four signed 32-bit values in A and B to SPFP form. */ +static __inline __m128 +_mm_cvtpi32x2_ps(__m64 __A, __m64 __B) +{ + __v4sf __zero = (__v4sf) __builtin_ia32_setzerops (); + __v4sf __sfa = __builtin_ia32_cvtpi2ps (__zero, (__v2si)__A); + __v4sf __sfb = __builtin_ia32_cvtpi2ps (__zero, (__v2si)__B); + return (__m128) __builtin_ia32_movlhps (__sfa, __sfb); +} + +/* Convert the four SPFP values in A to four signed 16-bit integers. */ +static __inline __m64 +_mm_cvtps_pi16(__m128 __A) +{ + __v4sf __hisf = (__v4sf)__A; + __v4sf __losf = __builtin_ia32_movhlps (__hisf, __hisf); + __v2si __hisi = __builtin_ia32_cvtps2pi (__hisf); + __v2si __losi = __builtin_ia32_cvtps2pi (__losf); + return (__m64) __builtin_ia32_packssdw (__hisi, __losi); +} + +/* Convert the four SPFP values in A to four signed 8-bit integers. */ +static __inline __m64 +_mm_cvtps_pi8(__m128 __A) +{ + __v4hi __tmp = (__v4hi) _mm_cvtps_pi16 (__A); + __v4hi __zero = (__v4hi) __builtin_ia32_mmx_zero (); + return (__m64) __builtin_ia32_packsswb (__tmp, __zero); +} + +/* Selects four specific SPFP values from A and B based on MASK. */ +#if 0 +static __inline __m128 +_mm_shuffle_ps (__m128 __A, __m128 __B, int __mask) +{ + return (__m128) __builtin_ia32_shufps ((__v4sf)__A, (__v4sf)__B, __mask); +} +#else +#define _mm_shuffle_ps(A, B, MASK) \ + ((__m128) __builtin_ia32_shufps ((__v4sf)(A), (__v4sf)(B), (MASK))) +#endif + + +/* Selects and interleaves the upper two SPFP values from A and B. */ +static __inline __m128 +_mm_unpackhi_ps (__m128 __A, __m128 __B) +{ + return (__m128) __builtin_ia32_unpckhps ((__v4sf)__A, (__v4sf)__B); +} + +/* Selects and interleaves the lower two SPFP values from A and B. */ +static __inline __m128 +_mm_unpacklo_ps (__m128 __A, __m128 __B) +{ + return (__m128) __builtin_ia32_unpcklps ((__v4sf)__A, (__v4sf)__B); +} + +/* Sets the upper two SPFP values with 64-bits of data loaded from P; + the lower two values are passed through from A. */ +static __inline __m128 +_mm_loadh_pi (__m128 __A, __m64 const *__P) +{ + return (__m128) __builtin_ia32_loadhps ((__v4sf)__A, (__v2si *)__P); +} + +/* Stores the upper two SPFP values of A into P. */ +static __inline void +_mm_storeh_pi (__m64 *__P, __m128 __A) +{ + __builtin_ia32_storehps ((__v2si *)__P, (__v4sf)__A); +} + +/* Moves the upper two values of B into the lower two values of A. */ +static __inline __m128 +_mm_movehl_ps (__m128 __A, __m128 __B) +{ + return (__m128) __builtin_ia32_movhlps ((__v4sf)__A, (__v4sf)__B); +} + +/* Moves the lower two values of B into the upper two values of A. */ +static __inline __m128 +_mm_movelh_ps (__m128 __A, __m128 __B) +{ + return (__m128) __builtin_ia32_movlhps ((__v4sf)__A, (__v4sf)__B); +} + +/* Sets the lower two SPFP values with 64-bits of data loaded from P; + the upper two values are passed through from A. */ +static __inline __m128 +_mm_loadl_pi (__m128 __A, __m64 const *__P) +{ + return (__m128) __builtin_ia32_loadlps ((__v4sf)__A, (__v2si *)__P); +} + +/* Stores the lower two SPFP values of A into P. */ +static __inline void +_mm_storel_pi (__m64 *__P, __m128 __A) +{ + __builtin_ia32_storelps ((__v2si *)__P, (__v4sf)__A); +} + +/* Creates a 4-bit mask from the most significant bits of the SPFP values. */ +static __inline int +_mm_movemask_ps (__m128 __A) +{ + return __builtin_ia32_movmskps ((__v4sf)__A); +} + +/* Return the contents of the control register. */ +static __inline unsigned int +_mm_getcsr (void) +{ + return __builtin_ia32_stmxcsr (); +} + +/* Read exception bits from the control register. */ +static __inline unsigned int +_MM_GET_EXCEPTION_STATE (void) +{ + return _mm_getcsr() & _MM_EXCEPT_MASK; +} + +static __inline unsigned int +_MM_GET_EXCEPTION_MASK (void) +{ + return _mm_getcsr() & _MM_MASK_MASK; +} + +static __inline unsigned int +_MM_GET_ROUNDING_MODE (void) +{ + return _mm_getcsr() & _MM_ROUND_MASK; +} + +static __inline unsigned int +_MM_GET_FLUSH_ZERO_MODE (void) +{ + return _mm_getcsr() & _MM_FLUSH_ZERO_MASK; +} + +/* Set the control register to I. */ +static __inline void +_mm_setcsr (unsigned int __I) +{ + __builtin_ia32_ldmxcsr (__I); +} + +/* Set exception bits in the control register. */ +static __inline void +_MM_SET_EXCEPTION_STATE(unsigned int __mask) +{ + _mm_setcsr((_mm_getcsr() & ~_MM_EXCEPT_MASK) | __mask); +} + +static __inline void +_MM_SET_EXCEPTION_MASK (unsigned int __mask) +{ + _mm_setcsr((_mm_getcsr() & ~_MM_MASK_MASK) | __mask); +} + +static __inline void +_MM_SET_ROUNDING_MODE (unsigned int __mode) +{ + _mm_setcsr((_mm_getcsr() & ~_MM_ROUND_MASK) | __mode); +} + +static __inline void +_MM_SET_FLUSH_ZERO_MODE (unsigned int __mode) +{ + _mm_setcsr((_mm_getcsr() & ~_MM_FLUSH_ZERO_MASK) | __mode); +} + +/* Create a vector with element 0 as *P and the rest zero. */ +static __inline __m128 +_mm_load_ss (float const *__P) +{ + return (__m128) __builtin_ia32_loadss (__P); +} + +/* Create a vector with all four elements equal to *P. */ +static __inline __m128 +_mm_load1_ps (float const *__P) +{ + __v4sf __tmp = __builtin_ia32_loadss (__P); + return (__m128) __builtin_ia32_shufps (__tmp, __tmp, _MM_SHUFFLE (0,0,0,0)); +} + +static __inline __m128 +_mm_load_ps1 (float const *__P) +{ + return _mm_load1_ps (__P); +} + +/* Load four SPFP values from P. The address must be 16-byte aligned. */ +static __inline __m128 +_mm_load_ps (float const *__P) +{ + return (__m128) __builtin_ia32_loadaps (__P); +} + +/* Load four SPFP values from P. The address need not be 16-byte aligned. */ +static __inline __m128 +_mm_loadu_ps (float const *__P) +{ + return (__m128) __builtin_ia32_loadups (__P); +} + +/* Load four SPFP values in reverse order. The address must be aligned. */ +static __inline __m128 +_mm_loadr_ps (float const *__P) +{ + __v4sf __tmp = __builtin_ia32_loadaps (__P); + return (__m128) __builtin_ia32_shufps (__tmp, __tmp, _MM_SHUFFLE (0,1,2,3)); +} + +/* Create a vector with element 0 as F and the rest zero. */ +static __inline __m128 +_mm_set_ss (float __F) +{ + return (__m128) __builtin_ia32_loadss (&__F); +} + +/* Create a vector with all four elements equal to F. */ +static __inline __m128 +_mm_set1_ps (float __F) +{ + __v4sf __tmp = __builtin_ia32_loadss (&__F); + return (__m128) __builtin_ia32_shufps (__tmp, __tmp, _MM_SHUFFLE (0,0,0,0)); +} + +static __inline __m128 +_mm_set_ps1 (float __F) +{ + return _mm_set1_ps (__F); +} + +/* Create the vector [Z Y X W]. */ +static __inline __m128 +_mm_set_ps (const float __Z, const float __Y, const float __X, const float __W) +{ + return (__v4sf) {__W, __X, __Y, __Z}; +} + +/* Create the vector [W X Y Z]. */ +static __inline __m128 +_mm_setr_ps (float __Z, float __Y, float __X, float __W) +{ + return _mm_set_ps (__W, __X, __Y, __Z); +} + +/* Create a vector of zeros. */ +static __inline __m128 +_mm_setzero_ps (void) +{ + return (__m128) __builtin_ia32_setzerops (); +} + +/* Stores the lower SPFP value. */ +static __inline void +_mm_store_ss (float *__P, __m128 __A) +{ + __builtin_ia32_storess (__P, (__v4sf)__A); +} + +/* Store the lower SPFP value across four words. */ +static __inline void +_mm_store1_ps (float *__P, __m128 __A) +{ + __v4sf __va = (__v4sf)__A; + __v4sf __tmp = __builtin_ia32_shufps (__va, __va, _MM_SHUFFLE (0,0,0,0)); + __builtin_ia32_storeaps (__P, __tmp); +} + +static __inline void +_mm_store_ps1 (float *__P, __m128 __A) +{ + _mm_store1_ps (__P, __A); +} + +/* Store four SPFP values. The address must be 16-byte aligned. */ +static __inline void +_mm_store_ps (float *__P, __m128 __A) +{ + __builtin_ia32_storeaps (__P, (__v4sf)__A); +} + +/* Store four SPFP values. The address need not be 16-byte aligned. */ +static __inline void +_mm_storeu_ps (float *__P, __m128 __A) +{ + __builtin_ia32_storeups (__P, (__v4sf)__A); +} + +/* Store four SPFP values in reverse order. The address must be aligned. */ +static __inline void +_mm_storer_ps (float *__P, __m128 __A) +{ + __v4sf __va = (__v4sf)__A; + __v4sf __tmp = __builtin_ia32_shufps (__va, __va, _MM_SHUFFLE (0,1,2,3)); + __builtin_ia32_storeaps (__P, __tmp); +} + +/* Sets the low SPFP value of A from the low value of B. */ +static __inline __m128 +_mm_move_ss (__m128 __A, __m128 __B) +{ + return (__m128) __builtin_ia32_movss ((__v4sf)__A, (__v4sf)__B); +} + +/* Extracts one of the four words of A. The selector N must be immediate. */ +#if 0 +static __inline int +_mm_extract_pi16 (__m64 __A, int __N) +{ + return __builtin_ia32_pextrw ((__v4hi)__A, __N); +} + +static __inline int +_m_pextrw (__m64 __A, int __N) +{ + return _mm_extract_pi16 (__A, __N); +} +#else +#define _mm_extract_pi16(A, N) \ + __builtin_ia32_pextrw ((__v4hi)(A), (N)) +#define _m_pextrw(A, N) _mm_extract_pi16((A), (N)) +#endif + +/* Inserts word D into one of four words of A. The selector N must be + immediate. */ +#if 0 +static __inline __m64 +_mm_insert_pi16 (__m64 __A, int __D, int __N) +{ + return (__m64)__builtin_ia32_pinsrw ((__v4hi)__A, __D, __N); +} + +static __inline __m64 +_m_pinsrw (__m64 __A, int __D, int __N) +{ + return _mm_insert_pi16 (__A, __D, __N); +} +#else +#define _mm_insert_pi16(A, D, N) \ + ((__m64) __builtin_ia32_pinsrw ((__v4hi)(A), (D), (N))) +#define _m_pinsrw(A, D, N) _mm_insert_pi16((A), (D), (N)) +#endif + +/* Compute the element-wise maximum of signed 16-bit values. */ +static __inline __m64 +_mm_max_pi16 (__m64 __A, __m64 __B) +{ + return (__m64) __builtin_ia32_pmaxsw ((__v4hi)__A, (__v4hi)__B); +} + +static __inline __m64 +_m_pmaxsw (__m64 __A, __m64 __B) +{ + return _mm_max_pi16 (__A, __B); +} + +/* Compute the element-wise maximum of unsigned 8-bit values. */ +static __inline __m64 +_mm_max_pu8 (__m64 __A, __m64 __B) +{ + return (__m64) __builtin_ia32_pmaxub ((__v8qi)__A, (__v8qi)__B); +} + +static __inline __m64 +_m_pmaxub (__m64 __A, __m64 __B) +{ + return _mm_max_pu8 (__A, __B); +} + +/* Compute the element-wise minimum of signed 16-bit values. */ +static __inline __m64 +_mm_min_pi16 (__m64 __A, __m64 __B) +{ + return (__m64) __builtin_ia32_pminsw ((__v4hi)__A, (__v4hi)__B); +} + +static __inline __m64 +_m_pminsw (__m64 __A, __m64 __B) +{ + return _mm_min_pi16 (__A, __B); +} + +/* Compute the element-wise minimum of unsigned 8-bit values. */ +static __inline __m64 +_mm_min_pu8 (__m64 __A, __m64 __B) +{ + return (__m64) __builtin_ia32_pminub ((__v8qi)__A, (__v8qi)__B); +} + +static __inline __m64 +_m_pminub (__m64 __A, __m64 __B) +{ + return _mm_min_pu8 (__A, __B); +} + +/* Create an 8-bit mask of the signs of 8-bit values. */ +static __inline int +_mm_movemask_pi8 (__m64 __A) +{ + return __builtin_ia32_pmovmskb ((__v8qi)__A); +} + +static __inline int +_m_pmovmskb (__m64 __A) +{ + return _mm_movemask_pi8 (__A); +} + +/* Multiply four unsigned 16-bit values in A by four unsigned 16-bit values + in B and produce the high 16 bits of the 32-bit results. */ +static __inline __m64 +_mm_mulhi_pu16 (__m64 __A, __m64 __B) +{ + return (__m64) __builtin_ia32_pmulhuw ((__v4hi)__A, (__v4hi)__B); +} + +static __inline __m64 +_m_pmulhuw (__m64 __A, __m64 __B) +{ + return _mm_mulhi_pu16 (__A, __B); +} + +/* Return a combination of the four 16-bit values in A. The selector + must be an immediate. */ +#if 0 +static __inline __m64 +_mm_shuffle_pi16 (__m64 __A, int __N) +{ + return (__m64) __builtin_ia32_pshufw ((__v4hi)__A, __N); +} + +static __inline __m64 +_m_pshufw (__m64 __A, int __N) +{ + return _mm_shuffle_pi16 (__A, __N); +} +#else +#define _mm_shuffle_pi16(A, N) \ + ((__m64) __builtin_ia32_pshufw ((__v4hi)(A), (N))) +#define _m_pshufw(A, N) _mm_shuffle_pi16 ((A), (N)) +#endif + +/* Conditionally store byte elements of A into P. The high bit of each + byte in the selector N determines whether the corresponding byte from + A is stored. */ +static __inline void +_mm_maskmove_si64 (__m64 __A, __m64 __N, char *__P) +{ + __builtin_ia32_maskmovq ((__v8qi)__A, (__v8qi)__N, __P); +} + +static __inline void +_m_maskmovq (__m64 __A, __m64 __N, char *__P) +{ + _mm_maskmove_si64 (__A, __N, __P); +} + +/* Compute the rounded averages of the unsigned 8-bit values in A and B. */ +static __inline __m64 +_mm_avg_pu8 (__m64 __A, __m64 __B) +{ + return (__m64) __builtin_ia32_pavgb ((__v8qi)__A, (__v8qi)__B); +} + +static __inline __m64 +_m_pavgb (__m64 __A, __m64 __B) +{ + return _mm_avg_pu8 (__A, __B); +} + +/* Compute the rounded averages of the unsigned 16-bit values in A and B. */ +static __inline __m64 +_mm_avg_pu16 (__m64 __A, __m64 __B) +{ + return (__m64) __builtin_ia32_pavgw ((__v4hi)__A, (__v4hi)__B); +} + +static __inline __m64 +_m_pavgw (__m64 __A, __m64 __B) +{ + return _mm_avg_pu16 (__A, __B); +} + +/* Compute the sum of the absolute differences of the unsigned 8-bit + values in A and B. Return the value in the lower 16-bit word; the + upper words are cleared. */ +static __inline __m64 +_mm_sad_pu8 (__m64 __A, __m64 __B) +{ + return (__m64) __builtin_ia32_psadbw ((__v8qi)__A, (__v8qi)__B); +} + +static __inline __m64 +_m_psadbw (__m64 __A, __m64 __B) +{ + return _mm_sad_pu8 (__A, __B); +} + +/* Loads one cache line from address P to a location "closer" to the + processor. The selector I specifies the type of prefetch operation. */ +#if 0 +static __inline void +_mm_prefetch (void *__P, enum _mm_hint __I) +{ + __builtin_prefetch (__P, 0, __I); +} +#else +#define _mm_prefetch(P, I) \ + __builtin_prefetch ((P), 0, (I)) +#endif + +/* Stores the data in A to the address P without polluting the caches. */ +static __inline void +_mm_stream_pi (__m64 *__P, __m64 __A) +{ + __builtin_ia32_movntq ((unsigned long long *)__P, (unsigned long long)__A); +} + +/* Likewise. The address must be 16-byte aligned. */ +static __inline void +_mm_stream_ps (float *__P, __m128 __A) +{ + __builtin_ia32_movntps (__P, (__v4sf)__A); +} + +/* Guarantees that every preceding store is globally visible before + any subsequent store. */ +static __inline void +_mm_sfence (void) +{ + __builtin_ia32_sfence (); +} + +/* The execution of the next instruction is delayed by an implementation + specific amount of time. The instruction does not modify the + architectural state. */ +static __inline void +_mm_pause (void) +{ + __asm__ __volatile__ ("rep; nop" : : ); +} + +/* Transpose the 4x4 matrix composed of row[0-3]. */ +#define _MM_TRANSPOSE4_PS(row0, row1, row2, row3) \ +do { \ + __v4sf __r0 = (row0), __r1 = (row1), __r2 = (row2), __r3 = (row3); \ + __v4sf __t0 = __builtin_ia32_shufps (__r0, __r1, 0x44); \ + __v4sf __t2 = __builtin_ia32_shufps (__r0, __r1, 0xEE); \ + __v4sf __t1 = __builtin_ia32_shufps (__r2, __r3, 0x44); \ + __v4sf __t3 = __builtin_ia32_shufps (__r2, __r3, 0xEE); \ + (row0) = __builtin_ia32_shufps (__t0, __t1, 0x88); \ + (row1) = __builtin_ia32_shufps (__t0, __t1, 0xDD); \ + (row2) = __builtin_ia32_shufps (__t2, __t3, 0x88); \ + (row3) = __builtin_ia32_shufps (__t2, __t3, 0xDD); \ +} while (0) + +/* For backward source compatibility. */ +#include + +#endif /* __SSE__ */ +#endif /* _XMMINTRIN_H_INCLUDED */ diff --git a/src/include.new/ypclnt.h b/src/include.new/ypclnt.h new file mode 100644 index 0000000..48537e6 --- /dev/null +++ b/src/include.new/ypclnt.h @@ -0,0 +1,62 @@ +/*- + * Copyright (c) 2002 Networks Associates Technology, Inc. + * All rights reserved. + * + * This software was developed for the FreeBSD Project by ThinkSec AS and + * NAI Labs, the Security Research Division of Network Associates, Inc. + * under DARPA/SPAWAR contract N66001-01-C-8035 ("CBOSS"), as part of the + * DARPA CHATS research program. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote + * products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD: src/lib/libypclnt/ypclnt.h,v 1.2 2002/05/08 00:48:39 des Exp $ + */ + +#ifndef _YPCLNT_H_INCLUDED + +typedef struct ypclnt ypclnt_t; +struct ypclnt { + char *domain; /* Domain name */ + char *map; /* Map name */ + char *server; /* Server name */ + char *error; /* Error message */ +}; + +struct passwd; + +ypclnt_t *ypclnt_new(const char *, const char *, const char *); +void ypclnt_free(ypclnt_t *); +void ypclnt_error(ypclnt_t *, const char *, const char *, ...); +int ypclnt_connect(ypclnt_t *); +int ypclnt_havepasswdd(ypclnt_t *); +int ypclnt_passwd(ypclnt_t *, const struct passwd *, const char *); + +#if defined(DEBUG) && defined(__GNUC__) +#define YPCLNT_DEBUG(fmt...) warnx(__FUNCTION__ ": " fmt, ##fmt) +#else +#define YPCLNT_DEBUG(fmt...) +#endif + +#endif diff --git a/src/include.new/zconf.h b/src/include.new/zconf.h new file mode 100644 index 0000000..ff60ccb --- /dev/null +++ b/src/include.new/zconf.h @@ -0,0 +1,341 @@ +/* zconf.h -- configuration of the zlib compression library + * Copyright (C) 1995-2005 Jean-loup Gailly. + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* @(#) $FreeBSD: src/lib/libz/zconf.h,v 1.9.2.1 2006/09/25 11:16:58 des Exp $ */ + +#ifndef ZCONF_H +#define ZCONF_H + +/* + * If you *really* need a unique prefix for all types and library functions, + * compile with -DZ_PREFIX. The "standard" zlib should be compiled without it. + */ +#ifdef Z_PREFIX +# define deflateInit_ z_deflateInit_ +# define deflate z_deflate +# define deflateEnd z_deflateEnd +# define inflateInit_ z_inflateInit_ +# define inflate z_inflate +# define inflateEnd z_inflateEnd +# define deflateInit2_ z_deflateInit2_ +# define deflateSetDictionary z_deflateSetDictionary +# define deflateCopy z_deflateCopy +# define deflateReset z_deflateReset +# define deflateParams z_deflateParams +# define deflateBound z_deflateBound +# define deflatePrime z_deflatePrime +# define inflateInit2_ z_inflateInit2_ +# define inflateSetDictionary z_inflateSetDictionary +# define inflateSync z_inflateSync +# define inflateSyncPoint z_inflateSyncPoint +# define inflateCopy z_inflateCopy +# define inflateReset z_inflateReset +# define inflateBack z_inflateBack +# define inflateBackEnd z_inflateBackEnd +# define compress z_compress +# define compress2 z_compress2 +# define compressBound z_compressBound +# define uncompress z_uncompress +# define adler32 z_adler32 +# define crc32 z_crc32 +# define get_crc_table z_get_crc_table +# define zError z_zError + +# define alloc_func z_alloc_func +# define free_func z_free_func +# define in_func z_in_func +# define out_func z_out_func +# define Byte z_Byte +# define uInt z_uInt +# define uLong z_uLong +# define Bytef z_Bytef +# define charf z_charf +# define intf z_intf +# define uIntf z_uIntf +# define uLongf z_uLongf +# define voidpf z_voidpf +# define voidp z_voidp +#endif + +#if defined(__MSDOS__) && !defined(MSDOS) +# define MSDOS +#endif +#if (defined(OS_2) || defined(__OS2__)) && !defined(OS2) +# define OS2 +#endif +#if defined(_WINDOWS) && !defined(WINDOWS) +# define WINDOWS +#endif +#if defined(_WIN32) || defined(_WIN32_WCE) || defined(__WIN32__) +# ifndef WIN32 +# define WIN32 +# endif +#endif +#if (defined(MSDOS) || defined(OS2) || defined(WINDOWS)) && !defined(WIN32) +# if !defined(__GNUC__) && !defined(__FLAT__) && !defined(__386__) +# ifndef SYS16BIT +# define SYS16BIT +# endif +# endif +#endif + +/* + * Compile with -DMAXSEG_64K if the alloc function cannot allocate more + * than 64k bytes at a time (needed on systems with 16-bit int). + */ +#ifdef SYS16BIT +# define MAXSEG_64K +#endif +#ifdef MSDOS +# define UNALIGNED_OK +#endif + +#ifdef __STDC_VERSION__ +# ifndef STDC +# define STDC +# endif +# if __STDC_VERSION__ >= 199901L +# ifndef STDC99 +# define STDC99 +# endif +# endif +#endif +#if !defined(STDC) && (defined(__STDC__) || defined(__cplusplus)) +# define STDC +#endif +#if !defined(STDC) && (defined(__GNUC__) || defined(__BORLANDC__)) +# define STDC +#endif +#if !defined(STDC) && (defined(MSDOS) || defined(WINDOWS) || defined(WIN32)) +# define STDC +#endif +#if !defined(STDC) && (defined(OS2) || defined(__HOS_AIX__)) +# define STDC +#endif + +#if defined(__OS400__) && !defined(STDC) /* iSeries (formerly AS/400). */ +# define STDC +#endif + +#ifndef STDC +# ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */ +# define const /* note: need a more gentle solution here */ +# endif +#endif + +/* Some Mac compilers merge all .h files incorrectly: */ +#if defined(__MWERKS__)||defined(applec)||defined(THINK_C)||defined(__SC__) +# define NO_DUMMY_DECL +#endif + +/* Maximum value for memLevel in deflateInit2 */ +#ifndef MAX_MEM_LEVEL +# ifdef MAXSEG_64K +# define MAX_MEM_LEVEL 8 +# else +# define MAX_MEM_LEVEL 9 +# endif +#endif + +/* Maximum value for windowBits in deflateInit2 and inflateInit2. + * WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files + * created by gzip. (Files created by minigzip can still be extracted by + * gzip.) + */ +#ifndef MAX_WBITS +# define MAX_WBITS 15 /* 32K LZ77 window */ +#endif + +/* The memory requirements for deflate are (in bytes): + (1 << (windowBits+2)) + (1 << (memLevel+9)) + that is: 128K for windowBits=15 + 128K for memLevel = 8 (default values) + plus a few kilobytes for small objects. For example, if you want to reduce + the default memory requirements from 256K to 128K, compile with + make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7" + Of course this will generally degrade compression (there's no free lunch). + + The memory requirements for inflate are (in bytes) 1 << windowBits + that is, 32K for windowBits=15 (default value) plus a few kilobytes + for small objects. +*/ + + /* Type declarations */ + +#ifndef OF /* function prototypes */ +# ifdef STDC +# define OF(args) args +# else +# define OF(args) () +# endif +#endif + +/* The following definitions for FAR are needed only for MSDOS mixed + * model programming (small or medium model with some far allocations). + * This was tested only with MSC; for other MSDOS compilers you may have + * to define NO_MEMCPY in zutil.h. If you don't need the mixed model, + * just define FAR to be empty. + */ +#ifdef SYS16BIT +# if defined(M_I86SM) || defined(M_I86MM) + /* MSC small or medium model */ +# define SMALL_MEDIUM +# ifdef _MSC_VER +# define FAR _far +# else +# define FAR far +# endif +# endif +# if (defined(__SMALL__) || defined(__MEDIUM__)) + /* Turbo C small or medium model */ +# define SMALL_MEDIUM +# ifdef __BORLANDC__ +# define FAR _far +# else +# define FAR far +# endif +# endif +#endif + +#if defined(WINDOWS) || defined(WIN32) + /* If building or using zlib as a DLL, define ZLIB_DLL. + * This is not mandatory, but it offers a little performance increase. + */ +# ifdef ZLIB_DLL +# if defined(WIN32) && (!defined(__BORLANDC__) || (__BORLANDC__ >= 0x500)) +# ifdef ZLIB_INTERNAL +# define ZEXTERN extern __declspec(dllexport) +# else +# define ZEXTERN extern __declspec(dllimport) +# endif +# endif +# endif /* ZLIB_DLL */ + /* If building or using zlib with the WINAPI/WINAPIV calling convention, + * define ZLIB_WINAPI. + * Caution: the standard ZLIB1.DLL is NOT compiled using ZLIB_WINAPI. + */ +# ifdef ZLIB_WINAPI +# ifdef FAR +# undef FAR +# endif +# include + /* No need for _export, use ZLIB.DEF instead. */ + /* For complete Windows compatibility, use WINAPI, not __stdcall. */ +# define ZEXPORT WINAPI +# ifdef WIN32 +# define ZEXPORTVA WINAPIV +# else +# define ZEXPORTVA FAR CDECL +# endif +# endif +#endif + +#if defined (__BEOS__) +# ifdef ZLIB_DLL +# ifdef ZLIB_INTERNAL +# define ZEXPORT __declspec(dllexport) +# define ZEXPORTVA __declspec(dllexport) +# else +# define ZEXPORT __declspec(dllimport) +# define ZEXPORTVA __declspec(dllimport) +# endif +# endif +#endif + +#ifndef ZEXTERN +# define ZEXTERN extern +#endif +#ifndef ZEXPORT +# define ZEXPORT +#endif +#ifndef ZEXPORTVA +# define ZEXPORTVA +#endif + +#ifndef FAR +# define FAR +#endif + +#if !defined(__MACTYPES__) +typedef unsigned char Byte; /* 8 bits */ +#endif +typedef unsigned int uInt; /* 16 bits or more */ +typedef unsigned long uLong; /* 32 bits or more */ + +#ifdef SMALL_MEDIUM + /* Borland C/C++ and some old MSC versions ignore FAR inside typedef */ +# define Bytef Byte FAR +#else + typedef Byte FAR Bytef; +#endif +typedef char FAR charf; +typedef int FAR intf; +typedef uInt FAR uIntf; +typedef uLong FAR uLongf; + +#ifdef STDC + typedef void const *voidpc; + typedef void FAR *voidpf; + typedef void *voidp; +#else + typedef Byte const *voidpc; + typedef Byte FAR *voidpf; + typedef Byte *voidp; +#endif + +#if 0 /* HAVE_UNISTD_H -- this line is updated by ./configure */ +# include /* for off_t */ +# include /* for SEEK_* and off_t */ +# ifdef VMS +# include /* for off_t */ +# endif +# define z_off_t off_t +#endif +#ifndef SEEK_SET +# define SEEK_SET 0 /* Seek from beginning of file. */ +# define SEEK_CUR 1 /* Seek from current position. */ +# define SEEK_END 2 /* Set file pointer to EOF plus "offset" */ +#endif + +/* + * This is hard-configured for FreeBSD, since zlib doesn't actually support + * using the system off_t for offsets unless off_t is no longer than long. + * To minimize the diff, we just "undef z_off_t" rather than modifying + * the following lines. + */ +#undef z_off_t + +#ifndef z_off_t +# define z_off_t long +#endif + +#if defined(__OS400__) +# define NO_vsnprintf +#endif + +#if defined(__MVS__) +# define NO_vsnprintf +# ifdef FAR +# undef FAR +# endif +#endif + +/* MVS linker does not support external names larger than 8 bytes */ +#if defined(__MVS__) +# pragma map(deflateInit_,"DEIN") +# pragma map(deflateInit2_,"DEIN2") +# pragma map(deflateEnd,"DEEND") +# pragma map(deflateBound,"DEBND") +# pragma map(inflateInit_,"ININ") +# pragma map(inflateInit2_,"ININ2") +# pragma map(inflateEnd,"INEND") +# pragma map(inflateSync,"INSY") +# pragma map(inflateSetDictionary,"INSEDI") +# pragma map(compressBound,"CMBND") +# pragma map(inflate_table,"INTABL") +# pragma map(inflate_fast,"INFA") +# pragma map(inflate_copyright,"INCOPY") +#endif + +#endif /* ZCONF_H */ diff --git a/src/include.new/zlib.h b/src/include.new/zlib.h new file mode 100644 index 0000000..0228179 --- /dev/null +++ b/src/include.new/zlib.h @@ -0,0 +1,1357 @@ +/* zlib.h -- interface of the 'zlib' general purpose compression library + version 1.2.3, July 18th, 2005 + + Copyright (C) 1995-2005 Jean-loup Gailly and Mark Adler + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. + + Jean-loup Gailly Mark Adler + jloup@gzip.org madler@alumni.caltech.edu + + + The data format used by the zlib library is described by RFCs (Request for + Comments) 1950 to 1952 in the files http://www.ietf.org/rfc/rfc1950.txt + (zlib format), rfc1951.txt (deflate format) and rfc1952.txt (gzip format). +*/ + +#ifndef ZLIB_H +#define ZLIB_H + +#include "zconf.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define ZLIB_VERSION "1.2.3" +#define ZLIB_VERNUM 0x1230 + +/* + The 'zlib' compression library provides in-memory compression and + decompression functions, including integrity checks of the uncompressed + data. This version of the library supports only one compression method + (deflation) but other algorithms will be added later and will have the same + stream interface. + + Compression can be done in a single step if the buffers are large + enough (for example if an input file is mmap'ed), or can be done by + repeated calls of the compression function. In the latter case, the + application must provide more input and/or consume the output + (providing more output space) before each call. + + The compressed data format used by default by the in-memory functions is + the zlib format, which is a zlib wrapper documented in RFC 1950, wrapped + around a deflate stream, which is itself documented in RFC 1951. + + The library also supports reading and writing files in gzip (.gz) format + with an interface similar to that of stdio using the functions that start + with "gz". The gzip format is different from the zlib format. gzip is a + gzip wrapper, documented in RFC 1952, wrapped around a deflate stream. + + This library can optionally read and write gzip streams in memory as well. + + The zlib format was designed to be compact and fast for use in memory + and on communications channels. The gzip format was designed for single- + file compression on file systems, has a larger header than zlib to maintain + directory information, and uses a different, slower check method than zlib. + + The library does not install any signal handler. The decoder checks + the consistency of the compressed data, so the library should never + crash even in case of corrupted input. +*/ + +typedef voidpf (*alloc_func) OF((voidpf opaque, uInt items, uInt size)); +typedef void (*free_func) OF((voidpf opaque, voidpf address)); + +struct internal_state; + +typedef struct z_stream_s { + Bytef *next_in; /* next input byte */ + uInt avail_in; /* number of bytes available at next_in */ + uLong total_in; /* total nb of input bytes read so far */ + + Bytef *next_out; /* next output byte should be put there */ + uInt avail_out; /* remaining free space at next_out */ + uLong total_out; /* total nb of bytes output so far */ + + char *msg; /* last error message, NULL if no error */ + struct internal_state FAR *state; /* not visible by applications */ + + alloc_func zalloc; /* used to allocate the internal state */ + free_func zfree; /* used to free the internal state */ + voidpf opaque; /* private data object passed to zalloc and zfree */ + + int data_type; /* best guess about the data type: binary or text */ + uLong adler; /* adler32 value of the uncompressed data */ + uLong reserved; /* reserved for future use */ +} z_stream; + +typedef z_stream FAR *z_streamp; + +/* + gzip header information passed to and from zlib routines. See RFC 1952 + for more details on the meanings of these fields. +*/ +typedef struct gz_header_s { + int text; /* true if compressed data believed to be text */ + uLong time; /* modification time */ + int xflags; /* extra flags (not used when writing a gzip file) */ + int os; /* operating system */ + Bytef *extra; /* pointer to extra field or Z_NULL if none */ + uInt extra_len; /* extra field length (valid if extra != Z_NULL) */ + uInt extra_max; /* space at extra (only when reading header) */ + Bytef *name; /* pointer to zero-terminated file name or Z_NULL */ + uInt name_max; /* space at name (only when reading header) */ + Bytef *comment; /* pointer to zero-terminated comment or Z_NULL */ + uInt comm_max; /* space at comment (only when reading header) */ + int hcrc; /* true if there was or will be a header crc */ + int done; /* true when done reading gzip header (not used + when writing a gzip file) */ +} gz_header; + +typedef gz_header FAR *gz_headerp; + +/* + The application must update next_in and avail_in when avail_in has + dropped to zero. It must update next_out and avail_out when avail_out + has dropped to zero. The application must initialize zalloc, zfree and + opaque before calling the init function. All other fields are set by the + compression library and must not be updated by the application. + + The opaque value provided by the application will be passed as the first + parameter for calls of zalloc and zfree. This can be useful for custom + memory management. The compression library attaches no meaning to the + opaque value. + + zalloc must return Z_NULL if there is not enough memory for the object. + If zlib is used in a multi-threaded application, zalloc and zfree must be + thread safe. + + On 16-bit systems, the functions zalloc and zfree must be able to allocate + exactly 65536 bytes, but will not be required to allocate more than this + if the symbol MAXSEG_64K is defined (see zconf.h). WARNING: On MSDOS, + pointers returned by zalloc for objects of exactly 65536 bytes *must* + have their offset normalized to zero. The default allocation function + provided by this library ensures this (see zutil.c). To reduce memory + requirements and avoid any allocation of 64K objects, at the expense of + compression ratio, compile the library with -DMAX_WBITS=14 (see zconf.h). + + The fields total_in and total_out can be used for statistics or + progress reports. After compression, total_in holds the total size of + the uncompressed data and may be saved for use in the decompressor + (particularly if the decompressor wants to decompress everything in + a single step). +*/ + + /* constants */ + +#define Z_NO_FLUSH 0 +#define Z_PARTIAL_FLUSH 1 /* will be removed, use Z_SYNC_FLUSH instead */ +#define Z_SYNC_FLUSH 2 +#define Z_FULL_FLUSH 3 +#define Z_FINISH 4 +#define Z_BLOCK 5 +/* Allowed flush values; see deflate() and inflate() below for details */ + +#define Z_OK 0 +#define Z_STREAM_END 1 +#define Z_NEED_DICT 2 +#define Z_ERRNO (-1) +#define Z_STREAM_ERROR (-2) +#define Z_DATA_ERROR (-3) +#define Z_MEM_ERROR (-4) +#define Z_BUF_ERROR (-5) +#define Z_VERSION_ERROR (-6) +/* Return codes for the compression/decompression functions. Negative + * values are errors, positive values are used for special but normal events. + */ + +#define Z_NO_COMPRESSION 0 +#define Z_BEST_SPEED 1 +#define Z_BEST_COMPRESSION 9 +#define Z_DEFAULT_COMPRESSION (-1) +/* compression levels */ + +#define Z_FILTERED 1 +#define Z_HUFFMAN_ONLY 2 +#define Z_RLE 3 +#define Z_FIXED 4 +#define Z_DEFAULT_STRATEGY 0 +/* compression strategy; see deflateInit2() below for details */ + +#define Z_BINARY 0 +#define Z_TEXT 1 +#define Z_ASCII Z_TEXT /* for compatibility with 1.2.2 and earlier */ +#define Z_UNKNOWN 2 +/* Possible values of the data_type field (though see inflate()) */ + +#define Z_DEFLATED 8 +/* The deflate compression method (the only one supported in this version) */ + +#define Z_NULL 0 /* for initializing zalloc, zfree, opaque */ + +#define zlib_version zlibVersion() +/* for compatibility with versions < 1.0.2 */ + + /* basic functions */ + +ZEXTERN const char * ZEXPORT zlibVersion OF((void)); +/* The application can compare zlibVersion and ZLIB_VERSION for consistency. + If the first character differs, the library code actually used is + not compatible with the zlib.h header file used by the application. + This check is automatically made by deflateInit and inflateInit. + */ + +/* +ZEXTERN int ZEXPORT deflateInit OF((z_streamp strm, int level)); + + Initializes the internal stream state for compression. The fields + zalloc, zfree and opaque must be initialized before by the caller. + If zalloc and zfree are set to Z_NULL, deflateInit updates them to + use default allocation functions. + + The compression level must be Z_DEFAULT_COMPRESSION, or between 0 and 9: + 1 gives best speed, 9 gives best compression, 0 gives no compression at + all (the input data is simply copied a block at a time). + Z_DEFAULT_COMPRESSION requests a default compromise between speed and + compression (currently equivalent to level 6). + + deflateInit returns Z_OK if success, Z_MEM_ERROR if there was not + enough memory, Z_STREAM_ERROR if level is not a valid compression level, + Z_VERSION_ERROR if the zlib library version (zlib_version) is incompatible + with the version assumed by the caller (ZLIB_VERSION). + msg is set to null if there is no error message. deflateInit does not + perform any compression: this will be done by deflate(). +*/ + + +ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush)); +/* + deflate compresses as much data as possible, and stops when the input + buffer becomes empty or the output buffer becomes full. It may introduce some + output latency (reading input without producing any output) except when + forced to flush. + + The detailed semantics are as follows. deflate performs one or both of the + following actions: + + - Compress more input starting at next_in and update next_in and avail_in + accordingly. If not all input can be processed (because there is not + enough room in the output buffer), next_in and avail_in are updated and + processing will resume at this point for the next call of deflate(). + + - Provide more output starting at next_out and update next_out and avail_out + accordingly. This action is forced if the parameter flush is non zero. + Forcing flush frequently degrades the compression ratio, so this parameter + should be set only when necessary (in interactive applications). + Some output may be provided even if flush is not set. + + Before the call of deflate(), the application should ensure that at least + one of the actions is possible, by providing more input and/or consuming + more output, and updating avail_in or avail_out accordingly; avail_out + should never be zero before the call. The application can consume the + compressed output when it wants, for example when the output buffer is full + (avail_out == 0), or after each call of deflate(). If deflate returns Z_OK + and with zero avail_out, it must be called again after making room in the + output buffer because there might be more output pending. + + Normally the parameter flush is set to Z_NO_FLUSH, which allows deflate to + decide how much data to accumualte before producing output, in order to + maximize compression. + + If the parameter flush is set to Z_SYNC_FLUSH, all pending output is + flushed to the output buffer and the output is aligned on a byte boundary, so + that the decompressor can get all input data available so far. (In particular + avail_in is zero after the call if enough output space has been provided + before the call.) Flushing may degrade compression for some compression + algorithms and so it should be used only when necessary. + + If flush is set to Z_FULL_FLUSH, all output is flushed as with + Z_SYNC_FLUSH, and the compression state is reset so that decompression can + restart from this point if previous compressed data has been damaged or if + random access is desired. Using Z_FULL_FLUSH too often can seriously degrade + compression. + + If deflate returns with avail_out == 0, this function must be called again + with the same value of the flush parameter and more output space (updated + avail_out), until the flush is complete (deflate returns with non-zero + avail_out). In the case of a Z_FULL_FLUSH or Z_SYNC_FLUSH, make sure that + avail_out is greater than six to avoid repeated flush markers due to + avail_out == 0 on return. + + If the parameter flush is set to Z_FINISH, pending input is processed, + pending output is flushed and deflate returns with Z_STREAM_END if there + was enough output space; if deflate returns with Z_OK, this function must be + called again with Z_FINISH and more output space (updated avail_out) but no + more input data, until it returns with Z_STREAM_END or an error. After + deflate has returned Z_STREAM_END, the only possible operations on the + stream are deflateReset or deflateEnd. + + Z_FINISH can be used immediately after deflateInit if all the compression + is to be done in a single step. In this case, avail_out must be at least + the value returned by deflateBound (see below). If deflate does not return + Z_STREAM_END, then it must be called again as described above. + + deflate() sets strm->adler to the adler32 checksum of all input read + so far (that is, total_in bytes). + + deflate() may update strm->data_type if it can make a good guess about + the input data type (Z_BINARY or Z_TEXT). In doubt, the data is considered + binary. This field is only for information purposes and does not affect + the compression algorithm in any manner. + + deflate() returns Z_OK if some progress has been made (more input + processed or more output produced), Z_STREAM_END if all input has been + consumed and all output has been produced (only when flush is set to + Z_FINISH), Z_STREAM_ERROR if the stream state was inconsistent (for example + if next_in or next_out was NULL), Z_BUF_ERROR if no progress is possible + (for example avail_in or avail_out was zero). Note that Z_BUF_ERROR is not + fatal, and deflate() can be called again with more input and more output + space to continue compressing. +*/ + + +ZEXTERN int ZEXPORT deflateEnd OF((z_streamp strm)); +/* + All dynamically allocated data structures for this stream are freed. + This function discards any unprocessed input and does not flush any + pending output. + + deflateEnd returns Z_OK if success, Z_STREAM_ERROR if the + stream state was inconsistent, Z_DATA_ERROR if the stream was freed + prematurely (some input or output was discarded). In the error case, + msg may be set but then points to a static string (which must not be + deallocated). +*/ + + +/* +ZEXTERN int ZEXPORT inflateInit OF((z_streamp strm)); + + Initializes the internal stream state for decompression. The fields + next_in, avail_in, zalloc, zfree and opaque must be initialized before by + the caller. If next_in is not Z_NULL and avail_in is large enough (the exact + value depends on the compression method), inflateInit determines the + compression method from the zlib header and allocates all data structures + accordingly; otherwise the allocation will be deferred to the first call of + inflate. If zalloc and zfree are set to Z_NULL, inflateInit updates them to + use default allocation functions. + + inflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough + memory, Z_VERSION_ERROR if the zlib library version is incompatible with the + version assumed by the caller. msg is set to null if there is no error + message. inflateInit does not perform any decompression apart from reading + the zlib header if present: this will be done by inflate(). (So next_in and + avail_in may be modified, but next_out and avail_out are unchanged.) +*/ + + +ZEXTERN int ZEXPORT inflate OF((z_streamp strm, int flush)); +/* + inflate decompresses as much data as possible, and stops when the input + buffer becomes empty or the output buffer becomes full. It may introduce + some output latency (reading input without producing any output) except when + forced to flush. + + The detailed semantics are as follows. inflate performs one or both of the + following actions: + + - Decompress more input starting at next_in and update next_in and avail_in + accordingly. If not all input can be processed (because there is not + enough room in the output buffer), next_in is updated and processing + will resume at this point for the next call of inflate(). + + - Provide more output starting at next_out and update next_out and avail_out + accordingly. inflate() provides as much output as possible, until there + is no more input data or no more space in the output buffer (see below + about the flush parameter). + + Before the call of inflate(), the application should ensure that at least + one of the actions is possible, by providing more input and/or consuming + more output, and updating the next_* and avail_* values accordingly. + The application can consume the uncompressed output when it wants, for + example when the output buffer is full (avail_out == 0), or after each + call of inflate(). If inflate returns Z_OK and with zero avail_out, it + must be called again after making room in the output buffer because there + might be more output pending. + + The flush parameter of inflate() can be Z_NO_FLUSH, Z_SYNC_FLUSH, + Z_FINISH, or Z_BLOCK. Z_SYNC_FLUSH requests that inflate() flush as much + output as possible to the output buffer. Z_BLOCK requests that inflate() stop + if and when it gets to the next deflate block boundary. When decoding the + zlib or gzip format, this will cause inflate() to return immediately after + the header and before the first block. When doing a raw inflate, inflate() + will go ahead and process the first block, and will return when it gets to + the end of that block, or when it runs out of data. + + The Z_BLOCK option assists in appending to or combining deflate streams. + Also to assist in this, on return inflate() will set strm->data_type to the + number of unused bits in the last byte taken from strm->next_in, plus 64 + if inflate() is currently decoding the last block in the deflate stream, + plus 128 if inflate() returned immediately after decoding an end-of-block + code or decoding the complete header up to just before the first byte of the + deflate stream. The end-of-block will not be indicated until all of the + uncompressed data from that block has been written to strm->next_out. The + number of unused bits may in general be greater than seven, except when + bit 7 of data_type is set, in which case the number of unused bits will be + less than eight. + + inflate() should normally be called until it returns Z_STREAM_END or an + error. However if all decompression is to be performed in a single step + (a single call of inflate), the parameter flush should be set to + Z_FINISH. In this case all pending input is processed and all pending + output is flushed; avail_out must be large enough to hold all the + uncompressed data. (The size of the uncompressed data may have been saved + by the compressor for this purpose.) The next operation on this stream must + be inflateEnd to deallocate the decompression state. The use of Z_FINISH + is never required, but can be used to inform inflate that a faster approach + may be used for the single inflate() call. + + In this implementation, inflate() always flushes as much output as + possible to the output buffer, and always uses the faster approach on the + first call. So the only effect of the flush parameter in this implementation + is on the return value of inflate(), as noted below, or when it returns early + because Z_BLOCK is used. + + If a preset dictionary is needed after this call (see inflateSetDictionary + below), inflate sets strm->adler to the adler32 checksum of the dictionary + chosen by the compressor and returns Z_NEED_DICT; otherwise it sets + strm->adler to the adler32 checksum of all output produced so far (that is, + total_out bytes) and returns Z_OK, Z_STREAM_END or an error code as described + below. At the end of the stream, inflate() checks that its computed adler32 + checksum is equal to that saved by the compressor and returns Z_STREAM_END + only if the checksum is correct. + + inflate() will decompress and check either zlib-wrapped or gzip-wrapped + deflate data. The header type is detected automatically. Any information + contained in the gzip header is not retained, so applications that need that + information should instead use raw inflate, see inflateInit2() below, or + inflateBack() and perform their own processing of the gzip header and + trailer. + + inflate() returns Z_OK if some progress has been made (more input processed + or more output produced), Z_STREAM_END if the end of the compressed data has + been reached and all uncompressed output has been produced, Z_NEED_DICT if a + preset dictionary is needed at this point, Z_DATA_ERROR if the input data was + corrupted (input stream not conforming to the zlib format or incorrect check + value), Z_STREAM_ERROR if the stream structure was inconsistent (for example + if next_in or next_out was NULL), Z_MEM_ERROR if there was not enough memory, + Z_BUF_ERROR if no progress is possible or if there was not enough room in the + output buffer when Z_FINISH is used. Note that Z_BUF_ERROR is not fatal, and + inflate() can be called again with more input and more output space to + continue decompressing. If Z_DATA_ERROR is returned, the application may then + call inflateSync() to look for a good compression block if a partial recovery + of the data is desired. +*/ + + +ZEXTERN int ZEXPORT inflateEnd OF((z_streamp strm)); +/* + All dynamically allocated data structures for this stream are freed. + This function discards any unprocessed input and does not flush any + pending output. + + inflateEnd returns Z_OK if success, Z_STREAM_ERROR if the stream state + was inconsistent. In the error case, msg may be set but then points to a + static string (which must not be deallocated). +*/ + + /* Advanced functions */ + +/* + The following functions are needed only in some special applications. +*/ + +/* +ZEXTERN int ZEXPORT deflateInit2 OF((z_streamp strm, + int level, + int method, + int windowBits, + int memLevel, + int strategy)); + + This is another version of deflateInit with more compression options. The + fields next_in, zalloc, zfree and opaque must be initialized before by + the caller. + + The method parameter is the compression method. It must be Z_DEFLATED in + this version of the library. + + The windowBits parameter is the base two logarithm of the window size + (the size of the history buffer). It should be in the range 8..15 for this + version of the library. Larger values of this parameter result in better + compression at the expense of memory usage. The default value is 15 if + deflateInit is used instead. + + windowBits can also be -8..-15 for raw deflate. In this case, -windowBits + determines the window size. deflate() will then generate raw deflate data + with no zlib header or trailer, and will not compute an adler32 check value. + + windowBits can also be greater than 15 for optional gzip encoding. Add + 16 to windowBits to write a simple gzip header and trailer around the + compressed data instead of a zlib wrapper. The gzip header will have no + file name, no extra data, no comment, no modification time (set to zero), + no header crc, and the operating system will be set to 255 (unknown). If a + gzip stream is being written, strm->adler is a crc32 instead of an adler32. + + The memLevel parameter specifies how much memory should be allocated + for the internal compression state. memLevel=1 uses minimum memory but + is slow and reduces compression ratio; memLevel=9 uses maximum memory + for optimal speed. The default value is 8. See zconf.h for total memory + usage as a function of windowBits and memLevel. + + The strategy parameter is used to tune the compression algorithm. Use the + value Z_DEFAULT_STRATEGY for normal data, Z_FILTERED for data produced by a + filter (or predictor), Z_HUFFMAN_ONLY to force Huffman encoding only (no + string match), or Z_RLE to limit match distances to one (run-length + encoding). Filtered data consists mostly of small values with a somewhat + random distribution. In this case, the compression algorithm is tuned to + compress them better. The effect of Z_FILTERED is to force more Huffman + coding and less string matching; it is somewhat intermediate between + Z_DEFAULT and Z_HUFFMAN_ONLY. Z_RLE is designed to be almost as fast as + Z_HUFFMAN_ONLY, but give better compression for PNG image data. The strategy + parameter only affects the compression ratio but not the correctness of the + compressed output even if it is not set appropriately. Z_FIXED prevents the + use of dynamic Huffman codes, allowing for a simpler decoder for special + applications. + + deflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough + memory, Z_STREAM_ERROR if a parameter is invalid (such as an invalid + method). msg is set to null if there is no error message. deflateInit2 does + not perform any compression: this will be done by deflate(). +*/ + +ZEXTERN int ZEXPORT deflateSetDictionary OF((z_streamp strm, + const Bytef *dictionary, + uInt dictLength)); +/* + Initializes the compression dictionary from the given byte sequence + without producing any compressed output. This function must be called + immediately after deflateInit, deflateInit2 or deflateReset, before any + call of deflate. The compressor and decompressor must use exactly the same + dictionary (see inflateSetDictionary). + + The dictionary should consist of strings (byte sequences) that are likely + to be encountered later in the data to be compressed, with the most commonly + used strings preferably put towards the end of the dictionary. Using a + dictionary is most useful when the data to be compressed is short and can be + predicted with good accuracy; the data can then be compressed better than + with the default empty dictionary. + + Depending on the size of the compression data structures selected by + deflateInit or deflateInit2, a part of the dictionary may in effect be + discarded, for example if the dictionary is larger than the window size in + deflate or deflate2. Thus the strings most likely to be useful should be + put at the end of the dictionary, not at the front. In addition, the + current implementation of deflate will use at most the window size minus + 262 bytes of the provided dictionary. + + Upon return of this function, strm->adler is set to the adler32 value + of the dictionary; the decompressor may later use this value to determine + which dictionary has been used by the compressor. (The adler32 value + applies to the whole dictionary even if only a subset of the dictionary is + actually used by the compressor.) If a raw deflate was requested, then the + adler32 value is not computed and strm->adler is not set. + + deflateSetDictionary returns Z_OK if success, or Z_STREAM_ERROR if a + parameter is invalid (such as NULL dictionary) or the stream state is + inconsistent (for example if deflate has already been called for this stream + or if the compression method is bsort). deflateSetDictionary does not + perform any compression: this will be done by deflate(). +*/ + +ZEXTERN int ZEXPORT deflateCopy OF((z_streamp dest, + z_streamp source)); +/* + Sets the destination stream as a complete copy of the source stream. + + This function can be useful when several compression strategies will be + tried, for example when there are several ways of pre-processing the input + data with a filter. The streams that will be discarded should then be freed + by calling deflateEnd. Note that deflateCopy duplicates the internal + compression state which can be quite large, so this strategy is slow and + can consume lots of memory. + + deflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not + enough memory, Z_STREAM_ERROR if the source stream state was inconsistent + (such as zalloc being NULL). msg is left unchanged in both source and + destination. +*/ + +ZEXTERN int ZEXPORT deflateReset OF((z_streamp strm)); +/* + This function is equivalent to deflateEnd followed by deflateInit, + but does not free and reallocate all the internal compression state. + The stream will keep the same compression level and any other attributes + that may have been set by deflateInit2. + + deflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source + stream state was inconsistent (such as zalloc or state being NULL). +*/ + +ZEXTERN int ZEXPORT deflateParams OF((z_streamp strm, + int level, + int strategy)); +/* + Dynamically update the compression level and compression strategy. The + interpretation of level and strategy is as in deflateInit2. This can be + used to switch between compression and straight copy of the input data, or + to switch to a different kind of input data requiring a different + strategy. If the compression level is changed, the input available so far + is compressed with the old level (and may be flushed); the new level will + take effect only at the next call of deflate(). + + Before the call of deflateParams, the stream state must be set as for + a call of deflate(), since the currently available input may have to + be compressed and flushed. In particular, strm->avail_out must be non-zero. + + deflateParams returns Z_OK if success, Z_STREAM_ERROR if the source + stream state was inconsistent or if a parameter was invalid, Z_BUF_ERROR + if strm->avail_out was zero. +*/ + +ZEXTERN int ZEXPORT deflateTune OF((z_streamp strm, + int good_length, + int max_lazy, + int nice_length, + int max_chain)); +/* + Fine tune deflate's internal compression parameters. This should only be + used by someone who understands the algorithm used by zlib's deflate for + searching for the best matching string, and even then only by the most + fanatic optimizer trying to squeeze out the last compressed bit for their + specific input data. Read the deflate.c source code for the meaning of the + max_lazy, good_length, nice_length, and max_chain parameters. + + deflateTune() can be called after deflateInit() or deflateInit2(), and + returns Z_OK on success, or Z_STREAM_ERROR for an invalid deflate stream. + */ + +ZEXTERN uLong ZEXPORT deflateBound OF((z_streamp strm, + uLong sourceLen)); +/* + deflateBound() returns an upper bound on the compressed size after + deflation of sourceLen bytes. It must be called after deflateInit() + or deflateInit2(). This would be used to allocate an output buffer + for deflation in a single pass, and so would be called before deflate(). +*/ + +ZEXTERN int ZEXPORT deflatePrime OF((z_streamp strm, + int bits, + int value)); +/* + deflatePrime() inserts bits in the deflate output stream. The intent + is that this function is used to start off the deflate output with the + bits leftover from a previous deflate stream when appending to it. As such, + this function can only be used for raw deflate, and must be used before the + first deflate() call after a deflateInit2() or deflateReset(). bits must be + less than or equal to 16, and that many of the least significant bits of + value will be inserted in the output. + + deflatePrime returns Z_OK if success, or Z_STREAM_ERROR if the source + stream state was inconsistent. +*/ + +ZEXTERN int ZEXPORT deflateSetHeader OF((z_streamp strm, + gz_headerp head)); +/* + deflateSetHeader() provides gzip header information for when a gzip + stream is requested by deflateInit2(). deflateSetHeader() may be called + after deflateInit2() or deflateReset() and before the first call of + deflate(). The text, time, os, extra field, name, and comment information + in the provided gz_header structure are written to the gzip header (xflag is + ignored -- the extra flags are set according to the compression level). The + caller must assure that, if not Z_NULL, name and comment are terminated with + a zero byte, and that if extra is not Z_NULL, that extra_len bytes are + available there. If hcrc is true, a gzip header crc is included. Note that + the current versions of the command-line version of gzip (up through version + 1.3.x) do not support header crc's, and will report that it is a "multi-part + gzip file" and give up. + + If deflateSetHeader is not used, the default gzip header has text false, + the time set to zero, and os set to 255, with no extra, name, or comment + fields. The gzip header is returned to the default state by deflateReset(). + + deflateSetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source + stream state was inconsistent. +*/ + +/* +ZEXTERN int ZEXPORT inflateInit2 OF((z_streamp strm, + int windowBits)); + + This is another version of inflateInit with an extra parameter. The + fields next_in, avail_in, zalloc, zfree and opaque must be initialized + before by the caller. + + The windowBits parameter is the base two logarithm of the maximum window + size (the size of the history buffer). It should be in the range 8..15 for + this version of the library. The default value is 15 if inflateInit is used + instead. windowBits must be greater than or equal to the windowBits value + provided to deflateInit2() while compressing, or it must be equal to 15 if + deflateInit2() was not used. If a compressed stream with a larger window + size is given as input, inflate() will return with the error code + Z_DATA_ERROR instead of trying to allocate a larger window. + + windowBits can also be -8..-15 for raw inflate. In this case, -windowBits + determines the window size. inflate() will then process raw deflate data, + not looking for a zlib or gzip header, not generating a check value, and not + looking for any check values for comparison at the end of the stream. This + is for use with other formats that use the deflate compressed data format + such as zip. Those formats provide their own check values. If a custom + format is developed using the raw deflate format for compressed data, it is + recommended that a check value such as an adler32 or a crc32 be applied to + the uncompressed data as is done in the zlib, gzip, and zip formats. For + most applications, the zlib format should be used as is. Note that comments + above on the use in deflateInit2() applies to the magnitude of windowBits. + + windowBits can also be greater than 15 for optional gzip decoding. Add + 32 to windowBits to enable zlib and gzip decoding with automatic header + detection, or add 16 to decode only the gzip format (the zlib format will + return a Z_DATA_ERROR). If a gzip stream is being decoded, strm->adler is + a crc32 instead of an adler32. + + inflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough + memory, Z_STREAM_ERROR if a parameter is invalid (such as a null strm). msg + is set to null if there is no error message. inflateInit2 does not perform + any decompression apart from reading the zlib header if present: this will + be done by inflate(). (So next_in and avail_in may be modified, but next_out + and avail_out are unchanged.) +*/ + +ZEXTERN int ZEXPORT inflateSetDictionary OF((z_streamp strm, + const Bytef *dictionary, + uInt dictLength)); +/* + Initializes the decompression dictionary from the given uncompressed byte + sequence. This function must be called immediately after a call of inflate, + if that call returned Z_NEED_DICT. The dictionary chosen by the compressor + can be determined from the adler32 value returned by that call of inflate. + The compressor and decompressor must use exactly the same dictionary (see + deflateSetDictionary). For raw inflate, this function can be called + immediately after inflateInit2() or inflateReset() and before any call of + inflate() to set the dictionary. The application must insure that the + dictionary that was used for compression is provided. + + inflateSetDictionary returns Z_OK if success, Z_STREAM_ERROR if a + parameter is invalid (such as NULL dictionary) or the stream state is + inconsistent, Z_DATA_ERROR if the given dictionary doesn't match the + expected one (incorrect adler32 value). inflateSetDictionary does not + perform any decompression: this will be done by subsequent calls of + inflate(). +*/ + +ZEXTERN int ZEXPORT inflateSync OF((z_streamp strm)); +/* + Skips invalid compressed data until a full flush point (see above the + description of deflate with Z_FULL_FLUSH) can be found, or until all + available input is skipped. No output is provided. + + inflateSync returns Z_OK if a full flush point has been found, Z_BUF_ERROR + if no more input was provided, Z_DATA_ERROR if no flush point has been found, + or Z_STREAM_ERROR if the stream structure was inconsistent. In the success + case, the application may save the current current value of total_in which + indicates where valid compressed data was found. In the error case, the + application may repeatedly call inflateSync, providing more input each time, + until success or end of the input data. +*/ + +ZEXTERN int ZEXPORT inflateCopy OF((z_streamp dest, + z_streamp source)); +/* + Sets the destination stream as a complete copy of the source stream. + + This function can be useful when randomly accessing a large stream. The + first pass through the stream can periodically record the inflate state, + allowing restarting inflate at those points when randomly accessing the + stream. + + inflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not + enough memory, Z_STREAM_ERROR if the source stream state was inconsistent + (such as zalloc being NULL). msg is left unchanged in both source and + destination. +*/ + +ZEXTERN int ZEXPORT inflateReset OF((z_streamp strm)); +/* + This function is equivalent to inflateEnd followed by inflateInit, + but does not free and reallocate all the internal decompression state. + The stream will keep attributes that may have been set by inflateInit2. + + inflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source + stream state was inconsistent (such as zalloc or state being NULL). +*/ + +ZEXTERN int ZEXPORT inflatePrime OF((z_streamp strm, + int bits, + int value)); +/* + This function inserts bits in the inflate input stream. The intent is + that this function is used to start inflating at a bit position in the + middle of a byte. The provided bits will be used before any bytes are used + from next_in. This function should only be used with raw inflate, and + should be used before the first inflate() call after inflateInit2() or + inflateReset(). bits must be less than or equal to 16, and that many of the + least significant bits of value will be inserted in the input. + + inflatePrime returns Z_OK if success, or Z_STREAM_ERROR if the source + stream state was inconsistent. +*/ + +ZEXTERN int ZEXPORT inflateGetHeader OF((z_streamp strm, + gz_headerp head)); +/* + inflateGetHeader() requests that gzip header information be stored in the + provided gz_header structure. inflateGetHeader() may be called after + inflateInit2() or inflateReset(), and before the first call of inflate(). + As inflate() processes the gzip stream, head->done is zero until the header + is completed, at which time head->done is set to one. If a zlib stream is + being decoded, then head->done is set to -1 to indicate that there will be + no gzip header information forthcoming. Note that Z_BLOCK can be used to + force inflate() to return immediately after header processing is complete + and before any actual data is decompressed. + + The text, time, xflags, and os fields are filled in with the gzip header + contents. hcrc is set to true if there is a header CRC. (The header CRC + was valid if done is set to one.) If extra is not Z_NULL, then extra_max + contains the maximum number of bytes to write to extra. Once done is true, + extra_len contains the actual extra field length, and extra contains the + extra field, or that field truncated if extra_max is less than extra_len. + If name is not Z_NULL, then up to name_max characters are written there, + terminated with a zero unless the length is greater than name_max. If + comment is not Z_NULL, then up to comm_max characters are written there, + terminated with a zero unless the length is greater than comm_max. When + any of extra, name, or comment are not Z_NULL and the respective field is + not present in the header, then that field is set to Z_NULL to signal its + absence. This allows the use of deflateSetHeader() with the returned + structure to duplicate the header. However if those fields are set to + allocated memory, then the application will need to save those pointers + elsewhere so that they can be eventually freed. + + If inflateGetHeader is not used, then the header information is simply + discarded. The header is always checked for validity, including the header + CRC if present. inflateReset() will reset the process to discard the header + information. The application would need to call inflateGetHeader() again to + retrieve the header from the next gzip stream. + + inflateGetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source + stream state was inconsistent. +*/ + +/* +ZEXTERN int ZEXPORT inflateBackInit OF((z_streamp strm, int windowBits, + unsigned char FAR *window)); + + Initialize the internal stream state for decompression using inflateBack() + calls. The fields zalloc, zfree and opaque in strm must be initialized + before the call. If zalloc and zfree are Z_NULL, then the default library- + derived memory allocation routines are used. windowBits is the base two + logarithm of the window size, in the range 8..15. window is a caller + supplied buffer of that size. Except for special applications where it is + assured that deflate was used with small window sizes, windowBits must be 15 + and a 32K byte window must be supplied to be able to decompress general + deflate streams. + + See inflateBack() for the usage of these routines. + + inflateBackInit will return Z_OK on success, Z_STREAM_ERROR if any of + the paramaters are invalid, Z_MEM_ERROR if the internal state could not + be allocated, or Z_VERSION_ERROR if the version of the library does not + match the version of the header file. +*/ + +typedef unsigned (*in_func) OF((void FAR *, unsigned char FAR * FAR *)); +typedef int (*out_func) OF((void FAR *, unsigned char FAR *, unsigned)); + +ZEXTERN int ZEXPORT inflateBack OF((z_streamp strm, + in_func in, void FAR *in_desc, + out_func out, void FAR *out_desc)); +/* + inflateBack() does a raw inflate with a single call using a call-back + interface for input and output. This is more efficient than inflate() for + file i/o applications in that it avoids copying between the output and the + sliding window by simply making the window itself the output buffer. This + function trusts the application to not change the output buffer passed by + the output function, at least until inflateBack() returns. + + inflateBackInit() must be called first to allocate the internal state + and to initialize the state with the user-provided window buffer. + inflateBack() may then be used multiple times to inflate a complete, raw + deflate stream with each call. inflateBackEnd() is then called to free + the allocated state. + + A raw deflate stream is one with no zlib or gzip header or trailer. + This routine would normally be used in a utility that reads zip or gzip + files and writes out uncompressed files. The utility would decode the + header and process the trailer on its own, hence this routine expects + only the raw deflate stream to decompress. This is different from the + normal behavior of inflate(), which expects either a zlib or gzip header and + trailer around the deflate stream. + + inflateBack() uses two subroutines supplied by the caller that are then + called by inflateBack() for input and output. inflateBack() calls those + routines until it reads a complete deflate stream and writes out all of the + uncompressed data, or until it encounters an error. The function's + parameters and return types are defined above in the in_func and out_func + typedefs. inflateBack() will call in(in_desc, &buf) which should return the + number of bytes of provided input, and a pointer to that input in buf. If + there is no input available, in() must return zero--buf is ignored in that + case--and inflateBack() will return a buffer error. inflateBack() will call + out(out_desc, buf, len) to write the uncompressed data buf[0..len-1]. out() + should return zero on success, or non-zero on failure. If out() returns + non-zero, inflateBack() will return with an error. Neither in() nor out() + are permitted to change the contents of the window provided to + inflateBackInit(), which is also the buffer that out() uses to write from. + The length written by out() will be at most the window size. Any non-zero + amount of input may be provided by in(). + + For convenience, inflateBack() can be provided input on the first call by + setting strm->next_in and strm->avail_in. If that input is exhausted, then + in() will be called. Therefore strm->next_in must be initialized before + calling inflateBack(). If strm->next_in is Z_NULL, then in() will be called + immediately for input. If strm->next_in is not Z_NULL, then strm->avail_in + must also be initialized, and then if strm->avail_in is not zero, input will + initially be taken from strm->next_in[0 .. strm->avail_in - 1]. + + The in_desc and out_desc parameters of inflateBack() is passed as the + first parameter of in() and out() respectively when they are called. These + descriptors can be optionally used to pass any information that the caller- + supplied in() and out() functions need to do their job. + + On return, inflateBack() will set strm->next_in and strm->avail_in to + pass back any unused input that was provided by the last in() call. The + return values of inflateBack() can be Z_STREAM_END on success, Z_BUF_ERROR + if in() or out() returned an error, Z_DATA_ERROR if there was a format + error in the deflate stream (in which case strm->msg is set to indicate the + nature of the error), or Z_STREAM_ERROR if the stream was not properly + initialized. In the case of Z_BUF_ERROR, an input or output error can be + distinguished using strm->next_in which will be Z_NULL only if in() returned + an error. If strm->next is not Z_NULL, then the Z_BUF_ERROR was due to + out() returning non-zero. (in() will always be called before out(), so + strm->next_in is assured to be defined if out() returns non-zero.) Note + that inflateBack() cannot return Z_OK. +*/ + +ZEXTERN int ZEXPORT inflateBackEnd OF((z_streamp strm)); +/* + All memory allocated by inflateBackInit() is freed. + + inflateBackEnd() returns Z_OK on success, or Z_STREAM_ERROR if the stream + state was inconsistent. +*/ + +ZEXTERN uLong ZEXPORT zlibCompileFlags OF((void)); +/* Return flags indicating compile-time options. + + Type sizes, two bits each, 00 = 16 bits, 01 = 32, 10 = 64, 11 = other: + 1.0: size of uInt + 3.2: size of uLong + 5.4: size of voidpf (pointer) + 7.6: size of z_off_t + + Compiler, assembler, and debug options: + 8: DEBUG + 9: ASMV or ASMINF -- use ASM code + 10: ZLIB_WINAPI -- exported functions use the WINAPI calling convention + 11: 0 (reserved) + + One-time table building (smaller code, but not thread-safe if true): + 12: BUILDFIXED -- build static block decoding tables when needed + 13: DYNAMIC_CRC_TABLE -- build CRC calculation tables when needed + 14,15: 0 (reserved) + + Library content (indicates missing functionality): + 16: NO_GZCOMPRESS -- gz* functions cannot compress (to avoid linking + deflate code when not needed) + 17: NO_GZIP -- deflate can't write gzip streams, and inflate can't detect + and decode gzip streams (to avoid linking crc code) + 18-19: 0 (reserved) + + Operation variations (changes in library functionality): + 20: PKZIP_BUG_WORKAROUND -- slightly more permissive inflate + 21: FASTEST -- deflate algorithm with only one, lowest compression level + 22,23: 0 (reserved) + + The sprintf variant used by gzprintf (zero is best): + 24: 0 = vs*, 1 = s* -- 1 means limited to 20 arguments after the format + 25: 0 = *nprintf, 1 = *printf -- 1 means gzprintf() not secure! + 26: 0 = returns value, 1 = void -- 1 means inferred string length returned + + Remainder: + 27-31: 0 (reserved) + */ + + + /* utility functions */ + +/* + The following utility functions are implemented on top of the + basic stream-oriented functions. To simplify the interface, some + default options are assumed (compression level and memory usage, + standard memory allocation functions). The source code of these + utility functions can easily be modified if you need special options. +*/ + +ZEXTERN int ZEXPORT compress OF((Bytef *dest, uLongf *destLen, + const Bytef *source, uLong sourceLen)); +/* + Compresses the source buffer into the destination buffer. sourceLen is + the byte length of the source buffer. Upon entry, destLen is the total + size of the destination buffer, which must be at least the value returned + by compressBound(sourceLen). Upon exit, destLen is the actual size of the + compressed buffer. + This function can be used to compress a whole file at once if the + input file is mmap'ed. + compress returns Z_OK if success, Z_MEM_ERROR if there was not + enough memory, Z_BUF_ERROR if there was not enough room in the output + buffer. +*/ + +ZEXTERN int ZEXPORT compress2 OF((Bytef *dest, uLongf *destLen, + const Bytef *source, uLong sourceLen, + int level)); +/* + Compresses the source buffer into the destination buffer. The level + parameter has the same meaning as in deflateInit. sourceLen is the byte + length of the source buffer. Upon entry, destLen is the total size of the + destination buffer, which must be at least the value returned by + compressBound(sourceLen). Upon exit, destLen is the actual size of the + compressed buffer. + + compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough + memory, Z_BUF_ERROR if there was not enough room in the output buffer, + Z_STREAM_ERROR if the level parameter is invalid. +*/ + +ZEXTERN uLong ZEXPORT compressBound OF((uLong sourceLen)); +/* + compressBound() returns an upper bound on the compressed size after + compress() or compress2() on sourceLen bytes. It would be used before + a compress() or compress2() call to allocate the destination buffer. +*/ + +ZEXTERN int ZEXPORT uncompress OF((Bytef *dest, uLongf *destLen, + const Bytef *source, uLong sourceLen)); +/* + Decompresses the source buffer into the destination buffer. sourceLen is + the byte length of the source buffer. Upon entry, destLen is the total + size of the destination buffer, which must be large enough to hold the + entire uncompressed data. (The size of the uncompressed data must have + been saved previously by the compressor and transmitted to the decompressor + by some mechanism outside the scope of this compression library.) + Upon exit, destLen is the actual size of the compressed buffer. + This function can be used to decompress a whole file at once if the + input file is mmap'ed. + + uncompress returns Z_OK if success, Z_MEM_ERROR if there was not + enough memory, Z_BUF_ERROR if there was not enough room in the output + buffer, or Z_DATA_ERROR if the input data was corrupted or incomplete. +*/ + + +typedef voidp gzFile; + +ZEXTERN gzFile ZEXPORT gzopen OF((const char *path, const char *mode)); +/* + Opens a gzip (.gz) file for reading or writing. The mode parameter + is as in fopen ("rb" or "wb") but can also include a compression level + ("wb9") or a strategy: 'f' for filtered data as in "wb6f", 'h' for + Huffman only compression as in "wb1h", or 'R' for run-length encoding + as in "wb1R". (See the description of deflateInit2 for more information + about the strategy parameter.) + + gzopen can be used to read a file which is not in gzip format; in this + case gzread will directly read from the file without decompression. + + gzopen returns NULL if the file could not be opened or if there was + insufficient memory to allocate the (de)compression state; errno + can be checked to distinguish the two cases (if errno is zero, the + zlib error is Z_MEM_ERROR). */ + +ZEXTERN gzFile ZEXPORT gzdopen OF((int fd, const char *mode)); +/* + gzdopen() associates a gzFile with the file descriptor fd. File + descriptors are obtained from calls like open, dup, creat, pipe or + fileno (in the file has been previously opened with fopen). + The mode parameter is as in gzopen. + The next call of gzclose on the returned gzFile will also close the + file descriptor fd, just like fclose(fdopen(fd), mode) closes the file + descriptor fd. If you want to keep fd open, use gzdopen(dup(fd), mode). + gzdopen returns NULL if there was insufficient memory to allocate + the (de)compression state. +*/ + +ZEXTERN int ZEXPORT gzsetparams OF((gzFile file, int level, int strategy)); +/* + Dynamically update the compression level or strategy. See the description + of deflateInit2 for the meaning of these parameters. + gzsetparams returns Z_OK if success, or Z_STREAM_ERROR if the file was not + opened for writing. +*/ + +ZEXTERN int ZEXPORT gzread OF((gzFile file, voidp buf, unsigned len)); +/* + Reads the given number of uncompressed bytes from the compressed file. + If the input file was not in gzip format, gzread copies the given number + of bytes into the buffer. + gzread returns the number of uncompressed bytes actually read (0 for + end of file, -1 for error). */ + +ZEXTERN int ZEXPORT gzwrite OF((gzFile file, + voidpc buf, unsigned len)); +/* + Writes the given number of uncompressed bytes into the compressed file. + gzwrite returns the number of uncompressed bytes actually written + (0 in case of error). +*/ + +ZEXTERN int ZEXPORTVA gzprintf OF((gzFile file, const char *format, ...)); +/* + Converts, formats, and writes the args to the compressed file under + control of the format string, as in fprintf. gzprintf returns the number of + uncompressed bytes actually written (0 in case of error). The number of + uncompressed bytes written is limited to 4095. The caller should assure that + this limit is not exceeded. If it is exceeded, then gzprintf() will return + return an error (0) with nothing written. In this case, there may also be a + buffer overflow with unpredictable consequences, which is possible only if + zlib was compiled with the insecure functions sprintf() or vsprintf() + because the secure snprintf() or vsnprintf() functions were not available. +*/ + +ZEXTERN int ZEXPORT gzputs OF((gzFile file, const char *s)); +/* + Writes the given null-terminated string to the compressed file, excluding + the terminating null character. + gzputs returns the number of characters written, or -1 in case of error. +*/ + +ZEXTERN char * ZEXPORT gzgets OF((gzFile file, char *buf, int len)); +/* + Reads bytes from the compressed file until len-1 characters are read, or + a newline character is read and transferred to buf, or an end-of-file + condition is encountered. The string is then terminated with a null + character. + gzgets returns buf, or Z_NULL in case of error. +*/ + +ZEXTERN int ZEXPORT gzputc OF((gzFile file, int c)); +/* + Writes c, converted to an unsigned char, into the compressed file. + gzputc returns the value that was written, or -1 in case of error. +*/ + +ZEXTERN int ZEXPORT gzgetc OF((gzFile file)); +/* + Reads one byte from the compressed file. gzgetc returns this byte + or -1 in case of end of file or error. +*/ + +ZEXTERN int ZEXPORT gzungetc OF((int c, gzFile file)); +/* + Push one character back onto the stream to be read again later. + Only one character of push-back is allowed. gzungetc() returns the + character pushed, or -1 on failure. gzungetc() will fail if a + character has been pushed but not read yet, or if c is -1. The pushed + character will be discarded if the stream is repositioned with gzseek() + or gzrewind(). +*/ + +ZEXTERN int ZEXPORT gzflush OF((gzFile file, int flush)); +/* + Flushes all pending output into the compressed file. The parameter + flush is as in the deflate() function. The return value is the zlib + error number (see function gzerror below). gzflush returns Z_OK if + the flush parameter is Z_FINISH and all output could be flushed. + gzflush should be called only when strictly necessary because it can + degrade compression. +*/ + +ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile file, + z_off_t offset, int whence)); +/* + Sets the starting position for the next gzread or gzwrite on the + given compressed file. The offset represents a number of bytes in the + uncompressed data stream. The whence parameter is defined as in lseek(2); + the value SEEK_END is not supported. + If the file is opened for reading, this function is emulated but can be + extremely slow. If the file is opened for writing, only forward seeks are + supported; gzseek then compresses a sequence of zeroes up to the new + starting position. + + gzseek returns the resulting offset location as measured in bytes from + the beginning of the uncompressed stream, or -1 in case of error, in + particular if the file is opened for writing and the new starting position + would be before the current position. +*/ + +ZEXTERN int ZEXPORT gzrewind OF((gzFile file)); +/* + Rewinds the given file. This function is supported only for reading. + + gzrewind(file) is equivalent to (int)gzseek(file, 0L, SEEK_SET) +*/ + +ZEXTERN z_off_t ZEXPORT gztell OF((gzFile file)); +/* + Returns the starting position for the next gzread or gzwrite on the + given compressed file. This position represents a number of bytes in the + uncompressed data stream. + + gztell(file) is equivalent to gzseek(file, 0L, SEEK_CUR) +*/ + +ZEXTERN int ZEXPORT gzeof OF((gzFile file)); +/* + Returns 1 when EOF has previously been detected reading the given + input stream, otherwise zero. +*/ + +ZEXTERN int ZEXPORT gzdirect OF((gzFile file)); +/* + Returns 1 if file is being read directly without decompression, otherwise + zero. +*/ + +ZEXTERN int ZEXPORT gzclose OF((gzFile file)); +/* + Flushes all pending output if necessary, closes the compressed file + and deallocates all the (de)compression state. The return value is the zlib + error number (see function gzerror below). +*/ + +ZEXTERN const char * ZEXPORT gzerror OF((gzFile file, int *errnum)); +/* + Returns the error message for the last error which occurred on the + given compressed file. errnum is set to zlib error number. If an + error occurred in the file system and not in the compression library, + errnum is set to Z_ERRNO and the application may consult errno + to get the exact error code. +*/ + +ZEXTERN void ZEXPORT gzclearerr OF((gzFile file)); +/* + Clears the error and end-of-file flags for file. This is analogous to the + clearerr() function in stdio. This is useful for continuing to read a gzip + file that is being written concurrently. +*/ + + /* checksum functions */ + +/* + These functions are not related to compression but are exported + anyway because they might be useful in applications using the + compression library. +*/ + +ZEXTERN uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len)); +/* + Update a running Adler-32 checksum with the bytes buf[0..len-1] and + return the updated checksum. If buf is NULL, this function returns + the required initial value for the checksum. + An Adler-32 checksum is almost as reliable as a CRC32 but can be computed + much faster. Usage example: + + uLong adler = adler32(0L, Z_NULL, 0); + + while (read_buffer(buffer, length) != EOF) { + adler = adler32(adler, buffer, length); + } + if (adler != original_adler) error(); +*/ + +ZEXTERN uLong ZEXPORT adler32_combine OF((uLong adler1, uLong adler2, + z_off_t len2)); +/* + Combine two Adler-32 checksums into one. For two sequences of bytes, seq1 + and seq2 with lengths len1 and len2, Adler-32 checksums were calculated for + each, adler1 and adler2. adler32_combine() returns the Adler-32 checksum of + seq1 and seq2 concatenated, requiring only adler1, adler2, and len2. +*/ + +ZEXTERN uLong ZEXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len)); +/* + Update a running CRC-32 with the bytes buf[0..len-1] and return the + updated CRC-32. If buf is NULL, this function returns the required initial + value for the for the crc. Pre- and post-conditioning (one's complement) is + performed within this function so it shouldn't be done by the application. + Usage example: + + uLong crc = crc32(0L, Z_NULL, 0); + + while (read_buffer(buffer, length) != EOF) { + crc = crc32(crc, buffer, length); + } + if (crc != original_crc) error(); +*/ + +ZEXTERN uLong ZEXPORT crc32_combine OF((uLong crc1, uLong crc2, z_off_t len2)); + +/* + Combine two CRC-32 check values into one. For two sequences of bytes, + seq1 and seq2 with lengths len1 and len2, CRC-32 check values were + calculated for each, crc1 and crc2. crc32_combine() returns the CRC-32 + check value of seq1 and seq2 concatenated, requiring only crc1, crc2, and + len2. +*/ + + + /* various hacks, don't look :) */ + +/* deflateInit and inflateInit are macros to allow checking the zlib version + * and the compiler's view of z_stream: + */ +ZEXTERN int ZEXPORT deflateInit_ OF((z_streamp strm, int level, + const char *version, int stream_size)); +ZEXTERN int ZEXPORT inflateInit_ OF((z_streamp strm, + const char *version, int stream_size)); +ZEXTERN int ZEXPORT deflateInit2_ OF((z_streamp strm, int level, int method, + int windowBits, int memLevel, + int strategy, const char *version, + int stream_size)); +ZEXTERN int ZEXPORT inflateInit2_ OF((z_streamp strm, int windowBits, + const char *version, int stream_size)); +ZEXTERN int ZEXPORT inflateBackInit_ OF((z_streamp strm, int windowBits, + unsigned char FAR *window, + const char *version, + int stream_size)); +#define deflateInit(strm, level) \ + deflateInit_((strm), (level), ZLIB_VERSION, sizeof(z_stream)) +#define inflateInit(strm) \ + inflateInit_((strm), ZLIB_VERSION, sizeof(z_stream)) +#define deflateInit2(strm, level, method, windowBits, memLevel, strategy) \ + deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\ + (strategy), ZLIB_VERSION, sizeof(z_stream)) +#define inflateInit2(strm, windowBits) \ + inflateInit2_((strm), (windowBits), ZLIB_VERSION, sizeof(z_stream)) +#define inflateBackInit(strm, windowBits, window) \ + inflateBackInit_((strm), (windowBits), (window), \ + ZLIB_VERSION, sizeof(z_stream)) + + +#if !defined(ZUTIL_H) && !defined(NO_DUMMY_DECL) + struct internal_state {int dummy;}; /* hack for buggy compilers */ +#endif + +ZEXTERN const char * ZEXPORT zError OF((int)); +ZEXTERN int ZEXPORT inflateSyncPoint OF((z_streamp z)); +ZEXTERN const uLongf * ZEXPORT get_crc_table OF((void)); + +#ifdef __cplusplus +} +#endif + +#endif /* ZLIB_H */ diff --git a/src/lib/Makefile.inc b/src/lib/Makefile.inc index b3cb8c4..9166914 100644 --- a/src/lib/Makefile.inc +++ b/src/lib/Makefile.inc @@ -2,4 +2,6 @@ # 'lib' options LDFLAGS = -Bshareable -CFLAGS = -fno-builtin +CFLAGS = -fno-builtin -Wno-uninitialized -O2 -fno-strict-aliasing -pipe + +INCLUDES = -I../include -I../../../include -I../i386 -I../include diff --git a/src/lib/libc/Makefile b/src/lib/libc/Makefile index fd87df1..7cbdaaa 100644 --- a/src/lib/libc/Makefile +++ b/src/lib/libc/Makefile @@ -9,7 +9,7 @@ OBJS = #Sub Sections -SUBS = ./*/*.o +SUBS = ./*/*.o ./db/*/*.o ./i386/*/*.o #Output OUTPUT = libc.so @@ -25,6 +25,7 @@ (cd stdio;make) (cd rpc;make) (cd resolv;make) + (cd regex;make) (cd quad;make) (cd posix1e;make) (cd nls;make) @@ -66,6 +67,7 @@ (cd stdio;make clean) (cd rpc;make clean) (cd resolv;make clean) + (cd regex;make clean) (cd quad;make clean) (cd posix1e;make clean) (cd nls;make clean) diff --git a/src/lib/libc/Makefile.inc b/src/lib/libc/Makefile.inc index d1c8f67..808bb59 100644 --- a/src/lib/libc/Makefile.inc +++ b/src/lib/libc/Makefile.inc @@ -1 +1,2 @@ INCLUDES = -I../include -I../../include.new +CFLAGS += -DPORTMAP -D__DBINTERFACE_PRIVATE diff --git a/src/lib/libc/xdr/Makefile b/src/lib/libc/xdr/Makefile index 265ba2b..b777397 100644 --- a/src/lib/libc/xdr/Makefile +++ b/src/lib/libc/xdr/Makefile @@ -9,7 +9,7 @@ INCLUDES += -I../rpc #Objects -OBJS = xdr.o xdr_array.o xdr_float.o xdr_mem.o xdr_rec.o xdr_reference.o xdr_sizeof.o xdr_stdio.o +OBJS = crypt_clnt.o crypt_xdr.o xdr.o xdr_array.o xdr_float.o xdr_mem.o xdr_rec.o xdr_reference.o xdr_sizeof.o xdr_stdio.o #Output OUTPUT = libc.so diff --git a/src/lib/libc/yp/Makefile b/src/lib/libc/yp/Makefile index ec28571..8c012e9 100644 --- a/src/lib/libc/yp/Makefile +++ b/src/lib/libc/yp/Makefile @@ -7,7 +7,7 @@ include ../Makefile.inc #Objects -OBJS = xdryp.o yplib.o +OBJS = xdryp.o yp_xdr.o yplib.o #Output OUTPUT = libc.so diff --git a/src/lib/ubix/startup.S b/src/lib/ubix/startup.S index 9997f42..e7f2977 100644 --- a/src/lib/ubix/startup.S +++ b/src/lib/ubix/startup.S @@ -27,7 +27,7 @@ *****************************************************************************************/ -.globl _start,__progname +.globl _start,__progname,environ .text .code32 _start: @@ -44,9 +44,14 @@ .data __progname: .long 0 +environ: + .long 0 /*** $Log$ + Revision 1.1.1.1 2006/06/01 12:46:10 reddawg + ubix2 + Revision 1.2 2005/10/12 00:13:36 reddawg Removed diff --git a/src/tools/Makefile b/src/tools/Makefile index 0773753..12bf56a 100644 --- a/src/tools/Makefile +++ b/src/tools/Makefile @@ -44,9 +44,9 @@ (cp ../bin/clock/clock /mnts/ubix/bin) (cp ../bin/fdisk/fdisk /mnts/ubix/bin) (cp ../bin/edit/edit /mnts/ubix/bin) - (cp ../bin/mount/mount /mnts/ubix/bin) (cp ../bin/ld/ld.so /mnts/ubix/lib) (cp ../lib/libc_old/libc_old.so /mnts/ubix/lib) + (cp ../lib/libc/libc.so /mnts/ubix/lib) (cp ../lib/ubix_api/ubix_api.so /mnts/ubix/lib) (cp ./userdb /mnts/ubix/etc) (cp ./motd /mnts/ubix/etc)