code:
/* Generated from /usr/src/kerberos5/lib/libkrb5/../../../crypto/heimdal/lib/krb5/heim_err.et */
/* $Id: heim_err.et 13352 2004-02-13 16:23:40Z lha $ */

#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_PKINIT_NO_CERTIFICATE = -1980176576,
	HEIM_PKINIT_NO_PRIVATE_KEY = -1980176575,
	HEIM_PKINIT_NO_VALID_CA = -1980176574,
	HEIM_PKINIT_CERTIFICATE_INVALID = -1980176573,
	HEIM_PKINIT_PRIVATE_KEY_INVALID = -1980176572,
	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__ */


code:
/*
 * Copyright (c) 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: heim_threads.h 14409 2004-12-18 16:03:38Z lha $ */

/*
 * Provide wrapper macros for thread synchronization primitives so we
 * can use native thread functions for those operating system that
 * supports it.
 *
 * This is so libkrb5.so (or more importantly, libgssapi.so) can have
 * thread support while the program that that dlopen(3)s the library
 * don't need to be linked to libpthread.
 */

#ifndef HEIM_THREADS_H
#define HEIM_THREADS_H 1

/* assume headers already included */

#if defined(__NetBSD__) && __NetBSD_Version__ >= 106120000 && __NetBSD_Version__< 299001200 && defined(ENABLE_PTHREAD_SUPPORT)

/*
 * NetBSD have a thread lib that we can use that part of libc that
 * works regardless if application are linked to pthreads or not.
 * NetBSD newer then 2.99.11 just use pthread.h, and the same thing
 * will happen.
 */
#include <threadlib.h>

#define HEIMDAL_MUTEX mutex_t
#define HEIMDAL_MUTEX_INITIALIZER MUTEX_INITIALIZER
#define HEIMDAL_MUTEX_init(m) mutex_init(m, NULL)
#define HEIMDAL_MUTEX_lock(m) mutex_lock(m)
#define HEIMDAL_MUTEX_unlock(m) mutex_unlock(m)
#define HEIMDAL_MUTEX_destroy(m) mutex_destroy(m)

#define HEIMDAL_RWLOCK rwlock_t
#define HEIMDAL_RWLOCK_INITIALIZER RWLOCK_INITIALIZER
#define	HEIMDAL_RWLOCK_init(l) rwlock_init(l, NULL)
#define	HEIMDAL_RWLOCK_rdlock(l) rwlock_rdlock(l)
#define	HEIMDAL_RWLOCK_wrlock(l) rwlock_wrlock(l)
#define	HEIMDAL_RWLOCK_tryrdlock(l) rwlock_tryrdlock(l)
#define	HEIMDAL_RWLOCK_trywrlock(l) rwlock_trywrlock(l)
#define	HEIMDAL_RWLOCK_unlock(l) rwlock_unlock(l)
#define	HEIMDAL_RWLOCK_destroy(l) rwlock_destroy(l)

#define HEIMDAL_thread_key thread_key_t
#define HEIMDAL_key_create(k,d,r) do { r = thr_keycreate(k,d); } while(0)
#define HEIMDAL_setspecific(k,s,r) do { r = thr_setspecific(k,s); } while(0)
#define HEIMDAL_getspecific(k) thr_getspecific(k)
#define HEIMDAL_key_delete(k) thr_keydelete(k)

#elif defined(ENABLE_PTHREAD_SUPPORT) && (!defined(__NetBSD__) || __NetBSD_Version__ >= 299001200)

#include <pthread.h>

#define HEIMDAL_MUTEX pthread_mutex_t
#define HEIMDAL_MUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER
#define HEIMDAL_MUTEX_init(m) pthread_mutex_init(m, NULL)
#define HEIMDAL_MUTEX_lock(m) pthread_mutex_lock(m)
#define HEIMDAL_MUTEX_unlock(m) pthread_mutex_unlock(m)
#define HEIMDAL_MUTEX_destroy(m) pthread_mutex_destroy(m)

#define HEIMDAL_RWLOCK rwlock_t
#define HEIMDAL_RWLOCK_INITIALIZER RWLOCK_INITIALIZER
#define	HEIMDAL_RWLOCK_init(l) pthread_rwlock_init(l, NULL)
#define	HEIMDAL_RWLOCK_rdlock(l) pthread_rwlock_rdlock(l)
#define	HEIMDAL_RWLOCK_wrlock(l) pthread_rwlock_wrlock(l)
#define	HEIMDAL_RWLOCK_tryrdlock(l) pthread_rwlock_tryrdlock(l)
#define	HEIMDAL_RWLOCK_trywrlock(l) pthread_rwlock_trywrlock(l)
#define	HEIMDAL_RWLOCK_unlock(l) pthread_rwlock_unlock(l)
#define	HEIMDAL_RWLOCK_destroy(l) pthread_rwlock_destroy(l)

#define HEIMDAL_thread_key pthread_key_t
#define HEIMDAL_key_create(k,d,r) do { r = pthread_key_create(k,d); } while(0)
#define HEIMDAL_setspecific(k,s,r) do { r = pthread_setspecific(k,s); } while(0)
#define HEIMDAL_getspecific(k) pthread_getspecific(k)
#define HEIMDAL_key_delete(k) pthread_key_delete(k)

#elif defined(HEIMDAL_DEBUG_THREADS)

/* no threads support, just do consistency checks */
#include <stdlib.h>

#define HEIMDAL_MUTEX int
#define HEIMDAL_MUTEX_INITIALIZER 0
#define HEIMDAL_MUTEX_init(m)  do { (*(m)) = 0; } while(0)
#define HEIMDAL_MUTEX_lock(m)  do { if ((*(m))++ != 0) abort(); } while(0)
#define HEIMDAL_MUTEX_unlock(m) do { if ((*(m))-- != 1) abort(); } while(0)
#define HEIMDAL_MUTEX_destroy(m) do {if ((*(m)) != 0) abort(); } while(0)

#define HEIMDAL_RWLOCK rwlock_t int
#define HEIMDAL_RWLOCK_INITIALIZER 0
#define	HEIMDAL_RWLOCK_init(l) do { } while(0)
#define	HEIMDAL_RWLOCK_rdlock(l) do { } while(0)
#define	HEIMDAL_RWLOCK_wrlock(l) do { } while(0)
#define	HEIMDAL_RWLOCK_tryrdlock(l) do { } while(0)
#define	HEIMDAL_RWLOCK_trywrlock(l) do { } while(0)
#define	HEIMDAL_RWLOCK_unlock(l) do { } while(0)
#define	HEIMDAL_RWLOCK_destroy(l) do { } while(0)

#define HEIMDAL_internal_thread_key 1

#else /* no thread support, no debug case */

#define HEIMDAL_MUTEX int
#define HEIMDAL_MUTEX_INITIALIZER 0
#define HEIMDAL_MUTEX_init(m)  do { (void)(m); } while(0)
#define HEIMDAL_MUTEX_lock(m)  do { (void)(m); } while(0)
#define HEIMDAL_MUTEX_unlock(m) do { (void)(m); } while(0)
#define HEIMDAL_MUTEX_destroy(m) do { (void)(m); } while(0)

#define HEIMDAL_RWLOCK rwlock_t int
#define HEIMDAL_RWLOCK_INITIALIZER 0
#define	HEIMDAL_RWLOCK_init(l) do { } while(0)
#define	HEIMDAL_RWLOCK_rdlock(l) do { } while(0)
#define	HEIMDAL_RWLOCK_wrlock(l) do { } while(0)
#define	HEIMDAL_RWLOCK_tryrdlock(l) do { } while(0)
#define	HEIMDAL_RWLOCK_trywrlock(l) do { } while(0)
#define	HEIMDAL_RWLOCK_unlock(l) do { } while(0)
#define	HEIMDAL_RWLOCK_destroy(l) do { } while(0)

#define HEIMDAL_internal_thread_key 1

#endif /* no thread support */

#ifdef HEIMDAL_internal_thread_key

typedef struct heim_thread_key {
    void *value;
    void (*destructor)(void *);
} heim_thread_key;

#define HEIMDAL_thread_key heim_thread_key
#define HEIMDAL_key_create(k,d,r) \
	do { (k)->value = NULL; (k)->destructor = (d); r = 0; } while(0)
#define HEIMDAL_setspecific(k,s,r) do { (k).value = s ; r = 0; } while(0)
#define HEIMDAL_getspecific(k) ((k).value)
#define HEIMDAL_key_delete(k) do { (*(k).destructor)((k).value); } while(0)

#undef HEIMDAL_internal_thread_key
#endif /* HEIMDAL_internal_thread_key */

#endif /* HEIM_THREADS_H */

repo_name: veiledmerc/mira

license: mit


code:
/* This is a generated file */
#ifndef __heimntlm_protos_h__
#define __heimntlm_protos_h__

#include <stdarg.h>

#ifdef __cplusplus
extern "C" {
#endif

int
heim_ntlm_build_ntlm1_master (
	void */*key*/,
	size_t /*len*/,
	struct ntlm_buf */*session*/,
	struct ntlm_buf */*master*/);

int
heim_ntlm_calculate_ntlm1 (
	void */*key*/,
	size_t /*len*/,
	unsigned char challange[8],
	struct ntlm_buf */*answer*/);

int
heim_ntlm_calculate_ntlm2 (
	const void */*key*/,
	size_t /*len*/,
	const char */*username*/,
	const char */*target*/,
	const unsigned char serverchallange[8],
	const struct ntlm_buf */*infotarget*/,
	unsigned char ntlmv2[16],
	struct ntlm_buf */*answer*/);

int
heim_ntlm_calculate_ntlm2_sess (
	const unsigned char clnt_nonce[8],
	const unsigned char svr_chal[8],
	const unsigned char ntlm_hash[16],
	struct ntlm_buf */*lm*/,
	struct ntlm_buf */*ntlm*/);

int
heim_ntlm_decode_targetinfo (
	const struct ntlm_buf */*data*/,
	int /*ucs2*/,
	struct ntlm_targetinfo */*ti*/);

int
heim_ntlm_decode_type1 (
	const struct ntlm_buf */*buf*/,
	struct ntlm_type1 */*data*/);

int
heim_ntlm_decode_type2 (
	const struct ntlm_buf */*buf*/,
	struct ntlm_type2 */*type2*/);

int
heim_ntlm_decode_type3 (
	const struct ntlm_buf */*buf*/,
	int /*ucs2*/,
	struct ntlm_type3 */*type3*/);

int
heim_ntlm_encode_targetinfo (
	const struct ntlm_targetinfo */*ti*/,
	int /*ucs2*/,
	struct ntlm_buf */*data*/);

int
heim_ntlm_encode_type1 (
	const struct ntlm_type1 */*type1*/,
	struct ntlm_buf */*data*/);

int
heim_ntlm_encode_type2 (
	const struct ntlm_type2 */*type2*/,
	struct ntlm_buf */*data*/);

int
heim_ntlm_encode_type3 (
	const struct ntlm_type3 */*type3*/,
	struct ntlm_buf */*data*/);

void
heim_ntlm_free_buf (struct ntlm_buf */*p*/);

void
heim_ntlm_free_targetinfo (struct ntlm_targetinfo */*ti*/);

void
heim_ntlm_free_type1 (struct ntlm_type1 */*data*/);

void
heim_ntlm_free_type2 (struct ntlm_type2 */*data*/);

void
heim_ntlm_free_type3 (struct ntlm_type3 */*data*/);

int
heim_ntlm_nt_key (
	const char */*password*/,
	struct ntlm_buf */*key*/);

void
heim_ntlm_ntlmv2_key (
	const void */*key*/,
	size_t /*len*/,
	const char */*username*/,
	const char */*target*/,
	unsigned char ntlmv2[16]);

int
heim_ntlm_verify_ntlm2 (
	const void */*key*/,
	size_t /*len*/,
	const char */*username*/,
	const char */*target*/,
	time_t /*now*/,
	const unsigned char serverchallange[8],
	const struct ntlm_buf */*answer*/,
	struct ntlm_buf */*infotarget*/,
	unsigned char ntlmv2[16]);

#ifdef __cplusplus
}
#endif

#endif /* __heimntlm_protos_h__ */


code:
/*
 * Copyright (c) 2006 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: heimntlm.h 22376 2007-12-28 18:38:23Z lha $ */

#ifndef HEIM_NTLM_H
#define HEIM_NTLM_H

/**
 * Buffer for storing data in the NTLM library. When filled in by the
 * library it should be freed with heim_ntlm_free_buf().
 */
struct ntlm_buf {
    size_t length; /**< length buffer data */
    void *data; /**< pointer to the data itself */
};

#define NTLM_NEG_UNICODE		0x00000001
#define NTLM_NEG_TARGET			0x00000004
#define NTLM_NEG_SIGN			0x00000010
#define NTLM_NEG_SEAL			0x00000020
#define NTLM_NEG_NTLM			0x00000200

#define NTLM_SUPPLIED_DOMAIN		0x00001000
#define NTLM_SUPPLIED_WORKSTAION	0x00002000

#define NTLM_NEG_ALWAYS_SIGN		0x00008000
#define NTLM_NEG_NTLM2_SESSION		0x00080000

#define NTLM_TARGET_DOMAIN		0x00010000
#define NTLM_TARGET_SERVER		0x00020000
#define NTLM_ENC_128			0x20000000
#define NTLM_NEG_KEYEX			0x40000000

/**
 * Struct for the NTLM target info, the strings is assumed to be in
 * UTF8.  When filled in by the library it should be freed with
 * heim_ntlm_free_targetinfo().
 */
struct ntlm_targetinfo {
    char *servername; /**< */
    char *domainname; /**< */
    char *dnsdomainname; /**< */
    char *dnsservername; /**< */
};

/**
 * Struct for the NTLM type1 message info, the strings is assumed to
 * be in UTF8.  When filled in by the library it should be freed with
 * heim_ntlm_free_type1().
 */

struct ntlm_type1 {
    uint32_t flags; /**< */
    char *domain; /**< */
    char *hostname; /**< */
    uint32_t os[2]; /**< */
};

/**
 * Struct for the NTLM type2 message info, the strings is assumed to
 * be in UTF8.  When filled in by the library it should be freed with
 * heim_ntlm_free_type2().
 */

struct ntlm_type2 {
    uint32_t flags; /**< */
    char *targetname; /**< */
    struct ntlm_buf targetinfo; /**< */
    unsigned char challange[8]; /**< */
    uint32_t context[2]; /**< */
    uint32_t os[2]; /**< */
};

/**
 * Struct for the NTLM type3 message info, the strings is assumed to
 * be in UTF8.  When filled in by the library it should be freed with
 * heim_ntlm_free_type3().
 */

struct ntlm_type3 {
    uint32_t flags; /**< */
    char *username; /**< */
    char *targetname; /**< */
    struct ntlm_buf lm; /**< */
    struct ntlm_buf ntlm; /**< */
    struct ntlm_buf sessionkey; /**< */
    char *ws; /**< */
    uint32_t os[2]; /**< */
};

#include <heimntlm-protos.h>

#endif /* NTLM_NTLM_H */


code:
/*-
 * 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.32 2007/06/10 20:20:28 christos Exp $
 * $FreeBSD: release/9.0.0/lib/libedit/histedit.h 220370 2011-04-05 18:41:01Z obrien $
 */

/*
 * histedit.h: Line editor and history interface.
 */
#ifndef _HISTEDIT_H_
#define	_HISTEDIT_H_

#include <sys/types.h>
#include <stdio.h>

__BEGIN_DECLS
#ifdef __cplusplus
extern "C" {
#endif

/*
 * ==== 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 *, const 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, ...);
unsigned char	_el_fn_complete(EditLine *, int);
unsigned char	_el_fn_sh_complete(EditLine *, int);

/*
 * 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_GETTC	17	/* , const char *, ..., NULL);	*/
#define	EL_GETFP	18	/* , int, FILE **)		*/
#define	EL_SETFP	19	/* , int, FILE *)		*/
#define	EL_REFRESH	20	/* , void);			      set     */
#define	EL_PROMPT_ESC	21	/* , prompt_func, Char);	      set/get */
#define	EL_RPROMPT_ESC	22	/* , prompt_func, Char);	      set/get */
#define	EL_RESIZE	23	/* , el_zfunc_t, void *);	      set     */

#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);		*/
#define	H_NEXT_EVDATA	23	/* , const int, histdata_t *);	*/
#define	H_DELDATA	24	/* , int, histdata_t *);*/
#define	H_REPLACE	25	/* , const char *, histdata_t);	*/

/*
 * ==== 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
#ifdef __cplusplus
}
#endif

#endif /* _HISTEDIT_H_ */


code:
/* This is a generated file */
#ifndef __hx509_private_h__
#define __hx509_private_h__

#include <stdarg.h>

#if !defined(__GNUC__) && !defined(__attribute__)
#define __attribute__(x)
#endif

int
_hx509_AlgorithmIdentifier_cmp (
	const AlgorithmIdentifier */*p*/,
	const AlgorithmIdentifier */*q*/);

int
_hx509_Certificate_cmp (
	const Certificate */*p*/,
	const Certificate */*q*/);

int
_hx509_Name_to_string (
	const Name */*n*/,
	char **/*str*/);

time_t
_hx509_Time2time_t (const Time */*t*/);

void
_hx509_abort (
	const char */*fmt*/,
	...)
    __attribute__ ((noreturn, format (printf, 1, 2)));

int
_hx509_calculate_path (
	hx509_context /*context*/,
	int /*flags*/,
	time_t /*time_now*/,
	hx509_certs /*anchors*/,
	unsigned int /*max_depth*/,
	hx509_cert /*cert*/,
	hx509_certs /*pool*/,
	hx509_path */*path*/);

int
_hx509_cert_assign_key (
	hx509_cert /*cert*/,
	hx509_private_key /*private_key*/);

int
_hx509_cert_get_eku (
	hx509_context /*context*/,
	hx509_cert /*cert*/,
	ExtKeyUsage */*e*/);

int
_hx509_cert_get_keyusage (
	hx509_context /*context*/,
	hx509_cert /*c*/,
	KeyUsage */*ku*/);

int
_hx509_cert_get_version (const Certificate */*t*/);

int
_hx509_cert_is_parent_cmp (
	const Certificate */*subject*/,
	const Certificate */*issuer*/,
	int /*allow_self_signed*/);

int
_hx509_cert_private_decrypt (
	hx509_context /*context*/,
	const heim_octet_string */*ciphertext*/,
	const heim_oid */*encryption_oid*/,
	hx509_cert /*p*/,
	heim_octet_string */*cleartext*/);

hx509_private_key
_hx509_cert_private_key (hx509_cert /*p*/);

int
_hx509_cert_private_key_exportable (hx509_cert /*p*/);

int
_hx509_cert_public_encrypt (
	hx509_context /*context*/,
	const heim_octet_string */*cleartext*/,
	const hx509_cert /*p*/,
	heim_oid */*encryption_oid*/,
	heim_octet_string */*ciphertext*/);

void
_hx509_cert_set_release (
	hx509_cert /*cert*/,
	_hx509_cert_release_func /*release*/,
	void */*ctx*/);

int
_hx509_certs_keys_add (
	hx509_context /*context*/,
	hx509_certs /*certs*/,
	hx509_private_key /*key*/);

void
_hx509_certs_keys_free (
	hx509_context /*context*/,
	hx509_private_key */*keys*/);

int
_hx509_certs_keys_get (
	hx509_context /*context*/,
	hx509_certs /*certs*/,
	hx509_private_key **/*keys*/);

hx509_certs
_hx509_certs_ref (hx509_certs /*certs*/);

int
_hx509_check_key_usage (
	hx509_context /*context*/,
	hx509_cert /*cert*/,
	unsigned /*flags*/,
	int /*req_present*/);

int
_hx509_collector_alloc (
	hx509_context /*context*/,
	hx509_lock /*lock*/,
	struct hx509_collector **/*collector*/);

int
_hx509_collector_certs_add (
	hx509_context /*context*/,
	struct hx509_collector */*c*/,
	hx509_cert /*cert*/);

int
_hx509_collector_collect_certs (
	hx509_context /*context*/,
	struct hx509_collector */*c*/,
	hx509_certs */*ret_certs*/);

int
_hx509_collector_collect_private_keys (
	hx509_context /*context*/,
	struct hx509_collector */*c*/,
	hx509_private_key **/*keys*/);

void
_hx509_collector_free (struct hx509_collector */*c*/);

hx509_lock
_hx509_collector_get_lock (struct hx509_collector */*c*/);

int
_hx509_collector_private_key_add (
	hx509_context /*context*/,
	struct hx509_collector */*c*/,
	const AlgorithmIdentifier */*alg*/,
	hx509_private_key /*private_key*/,
	const heim_octet_string */*key_data*/,
	const heim_octet_string */*localKeyId*/);

int
_hx509_create_signature (
	hx509_context /*context*/,
	const hx509_private_key /*signer*/,
	const AlgorithmIdentifier */*alg*/,
	const heim_octet_string */*data*/,
	AlgorithmIdentifier */*signatureAlgorithm*/,
	heim_octet_string */*sig*/);

int
_hx509_create_signature_bitstring (
	hx509_context /*context*/,
	const hx509_private_key /*signer*/,
	const AlgorithmIdentifier */*alg*/,
	const heim_octet_string */*data*/,
	AlgorithmIdentifier */*signatureAlgorithm*/,
	heim_bit_string */*sig*/);

int
_hx509_find_extension_subject_key_id (
	const Certificate */*issuer*/,
	SubjectKeyIdentifier */*si*/);

int
_hx509_generate_private_key (
	hx509_context /*context*/,
	struct hx509_generate_private_context */*ctx*/,
	hx509_private_key */*private_key*/);

int
_hx509_generate_private_key_bits (
	hx509_context /*context*/,
	struct hx509_generate_private_context */*ctx*/,
	unsigned long /*bits*/);

void
_hx509_generate_private_key_free (struct hx509_generate_private_context **/*ctx*/);

int
_hx509_generate_private_key_init (
	hx509_context /*context*/,
	const heim_oid */*oid*/,
	struct hx509_generate_private_context **/*ctx*/);

int
_hx509_generate_private_key_is_ca (
	hx509_context /*context*/,
	struct hx509_generate_private_context */*ctx*/);

Certificate *
_hx509_get_cert (hx509_cert /*cert*/);

void
_hx509_ks_dir_register (hx509_context /*context*/);

void
_hx509_ks_file_register (hx509_context /*context*/);

void
_hx509_ks_keychain_register (hx509_context /*context*/);

void
_hx509_ks_mem_register (hx509_context /*context*/);

void
_hx509_ks_null_register (hx509_context /*context*/);

void
_hx509_ks_pkcs11_register (hx509_context /*context*/);

void
_hx509_ks_pkcs12_register (hx509_context /*context*/);

void
_hx509_ks_register (
	hx509_context /*context*/,
	struct hx509_keyset_ops */*ops*/);

int
_hx509_lock_find_cert (
	hx509_lock /*lock*/,
	const hx509_query */*q*/,
	hx509_cert */*c*/);

const struct _hx509_password *
_hx509_lock_get_passwords (hx509_lock /*lock*/);

hx509_certs
_hx509_lock_unlock_certs (hx509_lock /*lock*/);

int
_hx509_map_file (
	const char */*fn*/,
	void **/*data*/,
	size_t */*length*/,
	struct stat */*rsb*/);

int
_hx509_map_file_os (
	const char */*fn*/,
	heim_octet_string */*os*/,
	struct stat */*rsb*/);

int
_hx509_match_keys (
	hx509_cert /*c*/,
	hx509_private_key /*private_key*/);

int
_hx509_name_cmp (
	const Name */*n1*/,
	const Name */*n2*/);

int
_hx509_name_ds_cmp (
	const DirectoryString */*ds1*/,
	const DirectoryString */*ds2*/);

int
_hx509_name_from_Name (
	const Name */*n*/,
	hx509_name */*name*/);

int
_hx509_name_modify (
	hx509_context /*context*/,
	Name */*name*/,
	int /*append*/,
	const heim_oid */*oid*/,
	const char */*str*/);

int
_hx509_parse_private_key (
	hx509_context /*context*/,
	const heim_oid */*key_oid*/,
	const void */*data*/,
	size_t /*len*/,
	hx509_private_key */*private_key*/);

int
_hx509_path_append (
	hx509_context /*context*/,
	hx509_path */*path*/,
	hx509_cert /*cert*/);

void
_hx509_path_free (hx509_path */*path*/);

int
_hx509_pbe_decrypt (
	hx509_context /*context*/,
	hx509_lock /*lock*/,
	const AlgorithmIdentifier */*ai*/,
	const heim_octet_string */*econtent*/,
	heim_octet_string */*content*/);

int
_hx509_pbe_encrypt (
	hx509_context /*context*/,
	hx509_lock /*lock*/,
	const AlgorithmIdentifier */*ai*/,
	const heim_octet_string */*content*/,
	heim_octet_string */*econtent*/);

void
_hx509_pi_printf (
	int (*/*func*/)(void *, const char *),
	void */*ctx*/,
	const char */*fmt*/,
	...);

int
_hx509_private_key2SPKI (
	hx509_context /*context*/,
	hx509_private_key /*private_key*/,
	SubjectPublicKeyInfo */*spki*/);

void
_hx509_private_key_assign_rsa (
	hx509_private_key /*key*/,
	void */*ptr*/);

int
_hx509_private_key_export (
	hx509_context /*context*/,
	const hx509_private_key /*key*/,
	heim_octet_string */*data*/);

int
_hx509_private_key_exportable (hx509_private_key /*key*/);

int
_hx509_private_key_free (hx509_private_key */*key*/);

BIGNUM *
_hx509_private_key_get_internal (
	hx509_context /*context*/,
	hx509_private_key /*key*/,
	const char */*type*/);

int
_hx509_private_key_init (
	hx509_private_key */*key*/,
	hx509_private_key_ops */*ops*/,
	void */*keydata*/);

int
_hx509_private_key_oid (
	hx509_context /*context*/,
	const hx509_private_key /*key*/,
	heim_oid */*data*/);

int
_hx509_private_key_private_decrypt (
	hx509_context /*context*/,
	const heim_octet_string */*ciphertext*/,
	const heim_oid */*encryption_oid*/,
	hx509_private_key /*p*/,
	heim_octet_string */*cleartext*/);

hx509_private_key
_hx509_private_key_ref (hx509_private_key /*key*/);

const char *
_hx509_private_pem_name (hx509_private_key /*key*/);

int
_hx509_public_encrypt (
	hx509_context /*context*/,
	const heim_octet_string */*cleartext*/,
	const Certificate */*cert*/,
	heim_oid */*encryption_oid*/,
	heim_octet_string */*ciphertext*/);

void
_hx509_query_clear (hx509_query */*q*/);

int
_hx509_query_match_cert (
	hx509_context /*context*/,
	const hx509_query */*q*/,
	hx509_cert /*cert*/);

void
_hx509_query_statistic (
	hx509_context /*context*/,
	int /*type*/,
	const hx509_query */*q*/);

int
_hx509_request_add_dns_name (
	hx509_context /*context*/,
	hx509_request /*req*/,
	const char */*hostname*/);

int
_hx509_request_add_eku (
	hx509_context /*context*/,
	hx509_request /*req*/,
	const heim_oid */*oid*/);

int
_hx509_request_add_email (
	hx509_context /*context*/,
	hx509_request /*req*/,
	const char */*email*/);

void
_hx509_request_free (hx509_request */*req*/);

int
_hx509_request_get_SubjectPublicKeyInfo (
	hx509_context /*context*/,
	hx509_request /*req*/,
	SubjectPublicKeyInfo */*key*/);

int
_hx509_request_get_name (
	hx509_context /*context*/,
	hx509_request /*req*/,
	hx509_name */*name*/);

int
_hx509_request_init (
	hx509_context /*context*/,
	hx509_request */*req*/);

int
_hx509_request_parse (
	hx509_context /*context*/,
	const char */*path*/,
	hx509_request */*req*/);

int
_hx509_request_print (
	hx509_context /*context*/,
	hx509_request /*req*/,
	FILE */*f*/);

int
_hx509_request_set_SubjectPublicKeyInfo (
	hx509_context /*context*/,
	hx509_request /*req*/,
	const SubjectPublicKeyInfo */*key*/);

int
_hx509_request_set_name (
	hx509_context /*context*/,
	hx509_request /*req*/,
	hx509_name /*name*/);

int
_hx509_request_to_pkcs10 (
	hx509_context /*context*/,
	const hx509_request /*req*/,
	const hx509_private_key /*signer*/,
	heim_octet_string */*request*/);

hx509_revoke_ctx
_hx509_revoke_ref (hx509_revoke_ctx /*ctx*/);

int
_hx509_set_cert_attribute (
	hx509_context /*context*/,
	hx509_cert /*cert*/,
	const heim_oid */*oid*/,
	const heim_octet_string */*attr*/);

void
_hx509_unmap_file (
	void */*data*/,
	size_t /*len*/);

void
_hx509_unmap_file_os (heim_octet_string */*os*/);

int
_hx509_unparse_Name (
	const Name */*aname*/,
	char **/*str*/);

int
_hx509_verify_signature (
	hx509_context /*context*/,
	const Certificate */*signer*/,
	const AlgorithmIdentifier */*alg*/,
	const heim_octet_string */*data*/,
	const heim_octet_string */*sig*/);

int
_hx509_verify_signature_bitstring (
	hx509_context /*context*/,
	const Certificate */*signer*/,
	const AlgorithmIdentifier */*alg*/,
	const heim_octet_string */*data*/,
	const heim_bit_string */*sig*/);

int
_hx509_write_file (
	const char */*fn*/,
	const void */*data*/,
	size_t /*length*/);

#endif /* __hx509_private_h__ */


code:
/* This is a generated file */
#ifndef __hx509_protos_h__
#define __hx509_protos_h__

#include <stdarg.h>

#ifdef __cplusplus
extern "C" {
#endif

#ifndef HX509_LIB_FUNCTION
#if defined(_WIN32)
#define HX509_LIB_FUNCTION _stdcall
#else
#define HX509_LIB_FUNCTION
#endif
#endif

void
hx509_bitstring_print (
	const heim_bit_string */*b*/,
	hx509_vprint_func /*func*/,
	void */*ctx*/);

int
hx509_ca_sign (
	hx509_context /*context*/,
	hx509_ca_tbs /*tbs*/,
	hx509_cert /*signer*/,
	hx509_cert */*certificate*/);

int
hx509_ca_sign_self (
	hx509_context /*context*/,
	hx509_ca_tbs /*tbs*/,
	hx509_private_key /*signer*/,
	hx509_cert */*certificate*/);

int
hx509_ca_tbs_add_crl_dp_uri (
	hx509_context /*context*/,
	hx509_ca_tbs /*tbs*/,
	const char */*uri*/,
	hx509_name /*issuername*/);

int
hx509_ca_tbs_add_eku (
	hx509_context /*context*/,
	hx509_ca_tbs /*tbs*/,
	const heim_oid */*oid*/);

int
hx509_ca_tbs_add_san_hostname (
	hx509_context /*context*/,
	hx509_ca_tbs /*tbs*/,
	const char */*dnsname*/);

int
hx509_ca_tbs_add_san_jid (
	hx509_context /*context*/,
	hx509_ca_tbs /*tbs*/,
	const char */*jid*/);

int
hx509_ca_tbs_add_san_ms_upn (
	hx509_context /*context*/,
	hx509_ca_tbs /*tbs*/,
	const char */*principal*/);

int
hx509_ca_tbs_add_san_otherName (
	hx509_context /*context*/,
	hx509_ca_tbs /*tbs*/,
	const heim_oid */*oid*/,
	const heim_octet_string */*os*/);

int
hx509_ca_tbs_add_san_pkinit (
	hx509_context /*context*/,
	hx509_ca_tbs /*tbs*/,
	const char */*principal*/);

int
hx509_ca_tbs_add_san_rfc822name (
	hx509_context /*context*/,
	hx509_ca_tbs /*tbs*/,
	const char */*rfc822Name*/);

void
hx509_ca_tbs_free (hx509_ca_tbs */*tbs*/);

int
hx509_ca_tbs_init (
	hx509_context /*context*/,
	hx509_ca_tbs */*tbs*/);

int
hx509_ca_tbs_set_ca (
	hx509_context /*context*/,
	hx509_ca_tbs /*tbs*/,
	int /*pathLenConstraint*/);

int
hx509_ca_tbs_set_domaincontroller (
	hx509_context /*context*/,
	hx509_ca_tbs /*tbs*/);

int
hx509_ca_tbs_set_notAfter (
	hx509_context /*context*/,
	hx509_ca_tbs /*tbs*/,
	time_t /*t*/);

int
hx509_ca_tbs_set_notAfter_lifetime (
	hx509_context /*context*/,
	hx509_ca_tbs /*tbs*/,
	time_t /*delta*/);

int
hx509_ca_tbs_set_notBefore (
	hx509_context /*context*/,
	hx509_ca_tbs /*tbs*/,
	time_t /*t*/);

int
hx509_ca_tbs_set_proxy (
	hx509_context /*context*/,
	hx509_ca_tbs /*tbs*/,
	int /*pathLenConstraint*/);

int
hx509_ca_tbs_set_serialnumber (
	hx509_context /*context*/,
	hx509_ca_tbs /*tbs*/,
	const heim_integer */*serialNumber*/);

int
hx509_ca_tbs_set_spki (
	hx509_context /*context*/,
	hx509_ca_tbs /*tbs*/,
	const SubjectPublicKeyInfo */*spki*/);

int
hx509_ca_tbs_set_subject (
	hx509_context /*context*/,
	hx509_ca_tbs /*tbs*/,
	hx509_name /*subject*/);

int
hx509_ca_tbs_set_template (
	hx509_context /*context*/,
	hx509_ca_tbs /*tbs*/,
	int /*flags*/,
	hx509_cert /*cert*/);

int
hx509_ca_tbs_subject_expand (
	hx509_context /*context*/,
	hx509_ca_tbs /*tbs*/,
	hx509_env /*env*/);

const struct units *
hx509_ca_tbs_template_units (void);

int
hx509_cert_binary (
	hx509_context /*context*/,
	hx509_cert /*c*/,
	heim_octet_string */*os*/);

int
hx509_cert_check_eku (
	hx509_context /*context*/,
	hx509_cert /*cert*/,
	const heim_oid */*eku*/,
	int /*allow_any_eku*/);

int
hx509_cert_cmp (
	hx509_cert /*p*/,
	hx509_cert /*q*/);

int
hx509_cert_find_subjectAltName_otherName (
	hx509_context /*context*/,
	hx509_cert /*cert*/,
	const heim_oid */*oid*/,
	hx509_octet_string_list */*list*/);

void
hx509_cert_free (hx509_cert /*cert*/);

int
hx509_cert_get_SPKI (
	hx509_context /*context*/,
	hx509_cert /*p*/,
	SubjectPublicKeyInfo */*spki*/);

int
hx509_cert_get_SPKI_AlgorithmIdentifier (
	hx509_context /*context*/,
	hx509_cert /*p*/,
	AlgorithmIdentifier */*alg*/);

hx509_cert_attribute
hx509_cert_get_attribute (
	hx509_cert /*cert*/,
	const heim_oid */*oid*/);

int
hx509_cert_get_base_subject (
	hx509_context /*context*/,
	hx509_cert /*c*/,
	hx509_name */*name*/);

const char *
hx509_cert_get_friendly_name (hx509_cert /*cert*/);

int
hx509_cert_get_issuer (
	hx509_cert /*p*/,
	hx509_name */*name*/);

time_t
hx509_cert_get_notAfter (hx509_cert /*p*/);

time_t
hx509_cert_get_notBefore (hx509_cert /*p*/);

int
hx509_cert_get_serialnumber (
	hx509_cert /*p*/,
	heim_integer */*i*/);

int
hx509_cert_get_subject (
	hx509_cert /*p*/,
	hx509_name */*name*/);

int
hx509_cert_have_private_key (hx509_cert /*p*/);

int
hx509_cert_init (
	hx509_context /*context*/,
	const Certificate */*c*/,
	hx509_cert */*cert*/);

int
hx509_cert_init_data (
	hx509_context /*context*/,
	const void */*ptr*/,
	size_t /*len*/,
	hx509_cert */*cert*/);

int
hx509_cert_keyusage_print (
	hx509_context /*context*/,
	hx509_cert /*c*/,
	char **/*s*/);

hx509_cert
hx509_cert_ref (hx509_cert /*cert*/);

int
hx509_cert_set_friendly_name (
	hx509_cert /*cert*/,
	const char */*name*/);

int
hx509_certs_add (
	hx509_context /*context*/,
	hx509_certs /*certs*/,
	hx509_cert /*cert*/);

int
hx509_certs_append (
	hx509_context /*context*/,
	hx509_certs /*to*/,
	hx509_lock /*lock*/,
	const char */*name*/);

int
hx509_certs_end_seq (
	hx509_context /*context*/,
	hx509_certs /*certs*/,
	hx509_cursor /*cursor*/);

int
hx509_certs_find (
	hx509_context /*context*/,
	hx509_certs /*certs*/,
	const hx509_query */*q*/,
	hx509_cert */*r*/);

void
hx509_certs_free (hx509_certs */*certs*/);

int
hx509_certs_info (
	hx509_context /*context*/,
	hx509_certs /*certs*/,
	int (*/*func*/)(void *, const char *),
	void */*ctx*/);

int
hx509_certs_init (
	hx509_context /*context*/,
	const char */*name*/,
	int /*flags*/,
	hx509_lock /*lock*/,
	hx509_certs */*certs*/);

int
hx509_certs_iter (
	hx509_context /*context*/,
	hx509_certs /*certs*/,
	int (*/*func*/)(hx509_context, void *, hx509_cert),
	void */*ctx*/);

int
hx509_certs_merge (
	hx509_context /*context*/,
	hx509_certs /*to*/,
	hx509_certs /*from*/);

int
hx509_certs_next_cert (
	hx509_context /*context*/,
	hx509_certs /*certs*/,
	hx509_cursor /*cursor*/,
	hx509_cert */*cert*/);

int
hx509_certs_start_seq (
	hx509_context /*context*/,
	hx509_certs /*certs*/,
	hx509_cursor */*cursor*/);

int
hx509_certs_store (
	hx509_context /*context*/,
	hx509_certs /*certs*/,
	int /*flags*/,
	hx509_lock /*lock*/);

int
hx509_ci_print_names (
	hx509_context /*context*/,
	void */*ctx*/,
	hx509_cert /*c*/);

void
hx509_clear_error_string (hx509_context /*context*/);

int
hx509_cms_create_signed_1 (
	hx509_context /*context*/,
	int /*flags*/,
	const heim_oid */*eContentType*/,
	const void */*data*/,
	size_t /*length*/,
	const AlgorithmIdentifier */*digest_alg*/,
	hx509_cert /*cert*/,
	hx509_peer_info /*peer*/,
	hx509_certs /*anchors*/,
	hx509_certs /*pool*/,
	heim_octet_string */*signed_data*/);

int
hx509_cms_decrypt_encrypted (
	hx509_context /*context*/,
	hx509_lock /*lock*/,
	const void */*data*/,
	size_t /*length*/,
	heim_oid */*contentType*/,
	heim_octet_string */*content*/);

int
hx509_cms_envelope_1 (
	hx509_context /*context*/,
	int /*flags*/,
	hx509_cert /*cert*/,
	const void */*data*/,
	size_t /*length*/,
	const heim_oid */*encryption_type*/,
	const heim_oid */*contentType*/,
	heim_octet_string */*content*/);

int
hx509_cms_unenvelope (
	hx509_context /*context*/,
	hx509_certs /*certs*/,
	int /*flags*/,
	const void */*data*/,
	size_t /*length*/,
	const heim_octet_string */*encryptedContent*/,
	heim_oid */*contentType*/,
	heim_octet_string */*content*/);

int
hx509_cms_unwrap_ContentInfo (
	const heim_octet_string */*in*/,
	heim_oid */*oid*/,
	heim_octet_string */*out*/,
	int */*have_data*/);

int
hx509_cms_verify_signed (
	hx509_context /*context*/,
	hx509_verify_ctx /*ctx*/,
	const void */*data*/,
	size_t /*length*/,
	const heim_octet_string */*signedContent*/,
	hx509_certs /*pool*/,
	heim_oid */*contentType*/,
	heim_octet_string */*content*/,
	hx509_certs */*signer_certs*/);

int
hx509_cms_wrap_ContentInfo (
	const heim_oid */*oid*/,
	const heim_octet_string */*buf*/,
	heim_octet_string */*res*/);

void
hx509_context_free (hx509_context */*context*/);

int
hx509_context_init (hx509_context */*context*/);

void
hx509_context_set_missing_revoke (
	hx509_context /*context*/,
	int /*flag*/);

int
hx509_crl_add_revoked_certs (
	hx509_context /*context*/,
	hx509_crl /*crl*/,
	hx509_certs /*certs*/);

int
hx509_crl_alloc (
	hx509_context /*context*/,
	hx509_crl */*crl*/);

void
hx509_crl_free (
	hx509_context /*context*/,
	hx509_crl */*crl*/);

int
hx509_crl_lifetime (
	hx509_context /*context*/,
	hx509_crl /*crl*/,
	int /*delta*/);

int
hx509_crl_sign (
	hx509_context /*context*/,
	hx509_cert /*signer*/,
	hx509_crl /*crl*/,
	heim_octet_string */*os*/);

const AlgorithmIdentifier *
hx509_crypto_aes128_cbc (void);

const AlgorithmIdentifier *
hx509_crypto_aes256_cbc (void);

int
hx509_crypto_available (
	hx509_context /*context*/,
	int /*type*/,
	hx509_cert /*source*/,
	AlgorithmIdentifier **/*val*/,
	unsigned int */*plen*/);

int
hx509_crypto_decrypt (
	hx509_crypto /*crypto*/,
	const void */*data*/,
	const size_t /*length*/,
	heim_octet_string */*ivec*/,
	heim_octet_string */*clear*/);

const AlgorithmIdentifier *
hx509_crypto_des_rsdi_ede3_cbc (void);

void
hx509_crypto_destroy (hx509_crypto /*crypto*/);

int
hx509_crypto_encrypt (
	hx509_crypto /*crypto*/,
	const void */*data*/,
	const size_t /*length*/,
	const heim_octet_string */*ivec*/,
	heim_octet_string **/*ciphertext*/);

const heim_oid *
hx509_crypto_enctype_by_name (const char */*name*/);

void
hx509_crypto_free_algs (
	AlgorithmIdentifier */*val*/,
	unsigned int /*len*/);

int
hx509_crypto_get_params (
	hx509_context /*context*/,
	hx509_crypto /*crypto*/,
	const heim_octet_string */*ivec*/,
	heim_octet_string */*param*/);

int
hx509_crypto_init (
	hx509_context /*context*/,
	const char */*provider*/,
	const heim_oid */*enctype*/,
	hx509_crypto */*crypto*/);

const char *
hx509_crypto_provider (hx509_crypto /*crypto*/);

int
hx509_crypto_random_iv (
	hx509_crypto /*crypto*/,
	heim_octet_string */*ivec*/);

int
hx509_crypto_select (
	const hx509_context /*context*/,
	int /*type*/,
	const hx509_private_key /*source*/,
	hx509_peer_info /*peer*/,
	AlgorithmIdentifier */*selected*/);

int
hx509_crypto_set_key_data (
	hx509_crypto /*crypto*/,
	const void */*data*/,
	size_t /*length*/);

int
hx509_crypto_set_key_name (
	hx509_crypto /*crypto*/,
	const char */*name*/);

int
hx509_crypto_set_params (
	hx509_context /*context*/,
	hx509_crypto /*crypto*/,
	const heim_octet_string */*param*/,
	heim_octet_string */*ivec*/);

int
hx509_crypto_set_random_key (
	hx509_crypto /*crypto*/,
	heim_octet_string */*key*/);

int
hx509_env_add (
	hx509_context /*context*/,
	hx509_env /*env*/,
	const char */*key*/,
	const char */*value*/);

void
hx509_env_free (hx509_env */*env*/);

int
hx509_env_init (
	hx509_context /*context*/,
	hx509_env */*env*/);

const char *
hx509_env_lfind (
	hx509_context /*context*/,
	hx509_env /*env*/,
	const char */*key*/,
	size_t /*len*/);

void
hx509_err (
	hx509_context /*context*/,
	int /*exit_code*/,
	int /*error_code*/,
	const char */*fmt*/,
	...);

void
hx509_free_error_string (char */*str*/);

void
hx509_free_octet_string_list (hx509_octet_string_list */*list*/);

int
hx509_general_name_unparse (
	GeneralName */*name*/,
	char **/*str*/);

char *
hx509_get_error_string (
	hx509_context /*context*/,
	int /*error_code*/);

int
hx509_get_one_cert (
	hx509_context /*context*/,
	hx509_certs /*certs*/,
	hx509_cert */*c*/);

int
hx509_lock_add_cert (
	hx509_context /*context*/,
	hx509_lock /*lock*/,
	hx509_cert /*cert*/);

int
hx509_lock_add_certs (
	hx509_context /*context*/,
	hx509_lock /*lock*/,
	hx509_certs /*certs*/);

int
hx509_lock_add_password (
	hx509_lock /*lock*/,
	const char */*password*/);

int
hx509_lock_command_string (
	hx509_lock /*lock*/,
	const char */*string*/);

void
hx509_lock_free (hx509_lock /*lock*/);

int
hx509_lock_init (
	hx509_context /*context*/,
	hx509_lock */*lock*/);

int
hx509_lock_prompt (
	hx509_lock /*lock*/,
	hx509_prompt */*prompt*/);

void
hx509_lock_reset_certs (
	hx509_context /*context*/,
	hx509_lock /*lock*/);

void
hx509_lock_reset_passwords (hx509_lock /*lock*/);

void
hx509_lock_reset_promper (hx509_lock /*lock*/);

int
hx509_lock_set_prompter (
	hx509_lock /*lock*/,
	hx509_prompter_fct /*prompt*/,
	void */*data*/);

int
hx509_name_binary (
	const hx509_name /*name*/,
	heim_octet_string */*os*/);

int
hx509_name_cmp (
	hx509_name /*n1*/,
	hx509_name /*n2*/);

int
hx509_name_copy (
	hx509_context /*context*/,
	const hx509_name /*from*/,
	hx509_name */*to*/);

int
hx509_name_expand (
	hx509_context /*context*/,
	hx509_name /*name*/,
	hx509_env /*env*/);

void
hx509_name_free (hx509_name */*name*/);

int
hx509_name_is_null_p (const hx509_name /*name*/);

int
hx509_name_normalize (
	hx509_context /*context*/,
	hx509_name /*name*/);

int
hx509_name_to_Name (
	const hx509_name /*from*/,
	Name */*to*/);

int
hx509_name_to_string (
	const hx509_name /*name*/,
	char **/*str*/);

int
hx509_ocsp_request (
	hx509_context /*context*/,
	hx509_certs /*reqcerts*/,
	hx509_certs /*pool*/,
	hx509_cert /*signer*/,
	const AlgorithmIdentifier */*digest*/,
	heim_octet_string */*request*/,
	heim_octet_string */*nonce*/);

int
hx509_ocsp_verify (
	hx509_context /*context*/,
	time_t /*now*/,
	hx509_cert /*cert*/,
	int /*flags*/,
	const void */*data*/,
	size_t /*length*/,
	time_t */*expiration*/);

void
hx509_oid_print (
	const heim_oid */*oid*/,
	hx509_vprint_func /*func*/,
	void */*ctx*/);

int
hx509_oid_sprint (
	const heim_oid */*oid*/,
	char **/*str*/);

int
hx509_parse_name (
	hx509_context /*context*/,
	const char */*str*/,
	hx509_name */*name*/);

int
hx509_peer_info_alloc (
	hx509_context /*context*/,
	hx509_peer_info */*peer*/);

void
hx509_peer_info_free (hx509_peer_info /*peer*/);

int
hx509_peer_info_set_cert (
	hx509_peer_info /*peer*/,
	hx509_cert /*cert*/);

int
hx509_peer_info_set_cms_algs (
	hx509_context /*context*/,
	hx509_peer_info /*peer*/,
	const AlgorithmIdentifier */*val*/,
	size_t /*len*/);

int
hx509_pem_add_header (
	hx509_pem_header **/*headers*/,
	const char */*header*/,
	const char */*value*/);

const char *
hx509_pem_find_header (
	const hx509_pem_header */*h*/,
	const char */*header*/);

void
hx509_pem_free_header (hx509_pem_header */*headers*/);

int
hx509_pem_read (
	hx509_context /*context*/,
	FILE */*f*/,
	hx509_pem_read_func /*func*/,
	void */*ctx*/);

int
hx509_pem_write (
	hx509_context /*context*/,
	const char */*type*/,
	hx509_pem_header */*headers*/,
	FILE */*f*/,
	const void */*data*/,
	size_t /*size*/);

void
hx509_print_stdout (
	void */*ctx*/,
	const char */*fmt*/,
	va_list /*va*/);

int
hx509_prompt_hidden (hx509_prompt_type /*type*/);

int
hx509_query_alloc (
	hx509_context /*context*/,
	hx509_query **/*q*/);

void
hx509_query_free (
	hx509_context /*context*/,
	hx509_query */*q*/);

int
hx509_query_match_cmp_func (
	hx509_query */*q*/,
	int (*/*func*/)(void *, hx509_cert),
	void */*ctx*/);

int
hx509_query_match_friendly_name (
	hx509_query */*q*/,
	const char */*name*/);

int
hx509_query_match_issuer_serial (
	hx509_query */*q*/,
	const Name */*issuer*/,
	const heim_integer */*serialNumber*/);

void
hx509_query_match_option (
	hx509_query */*q*/,
	hx509_query_option /*option*/);

void
hx509_query_statistic_file (
	hx509_context /*context*/,
	const char */*fn*/);

void
hx509_query_unparse_stats (
	hx509_context /*context*/,
	int /*printtype*/,
	FILE */*out*/);

int
hx509_revoke_add_crl (
	hx509_context /*context*/,
	hx509_revoke_ctx /*ctx*/,
	const char */*path*/);

int
hx509_revoke_add_ocsp (
	hx509_context /*context*/,
	hx509_revoke_ctx /*ctx*/,
	const char */*path*/);

void
hx509_revoke_free (hx509_revoke_ctx */*ctx*/);

int
hx509_revoke_init (
	hx509_context /*context*/,
	hx509_revoke_ctx */*ctx*/);

int
hx509_revoke_ocsp_print (
	hx509_context /*context*/,
	const char */*path*/,
	FILE */*out*/);

int
hx509_revoke_verify (
	hx509_context /*context*/,
	hx509_revoke_ctx /*ctx*/,
	hx509_certs /*certs*/,
	time_t /*now*/,
	hx509_cert /*cert*/,
	hx509_cert /*parent_cert*/);

void
hx509_set_error_string (
	hx509_context /*context*/,
	int /*flags*/,
	int /*code*/,
	const char */*fmt*/,
	...);

void
hx509_set_error_stringv (
	hx509_context /*context*/,
	int /*flags*/,
	int /*code*/,
	const char */*fmt*/,
	va_list /*ap*/);

const AlgorithmIdentifier *
hx509_signature_md2 (void);

const AlgorithmIdentifier *
hx509_signature_md5 (void);

const AlgorithmIdentifier *
hx509_signature_rsa (void);

const AlgorithmIdentifier *
hx509_signature_rsa_pkcs1_x509 (void);

const AlgorithmIdentifier *
hx509_signature_rsa_with_md2 (void);

const AlgorithmIdentifier *
hx509_signature_rsa_with_md5 (void);

const AlgorithmIdentifier *
hx509_signature_rsa_with_sha1 (void);

const AlgorithmIdentifier *
hx509_signature_rsa_with_sha256 (void);

const AlgorithmIdentifier *
hx509_signature_rsa_with_sha384 (void);

const AlgorithmIdentifier *
hx509_signature_rsa_with_sha512 (void);

const AlgorithmIdentifier *
hx509_signature_sha1 (void);

const AlgorithmIdentifier *
hx509_signature_sha256 (void);

const AlgorithmIdentifier *
hx509_signature_sha384 (void);

const AlgorithmIdentifier *
hx509_signature_sha512 (void);

int
hx509_unparse_der_name (
	const void */*data*/,
	size_t /*length*/,
	char **/*str*/);

int
hx509_validate_cert (
	hx509_context /*context*/,
	hx509_validate_ctx /*ctx*/,
	hx509_cert /*cert*/);

void
hx509_validate_ctx_add_flags (
	hx509_validate_ctx /*ctx*/,
	int /*flags*/);

void
hx509_validate_ctx_free (hx509_validate_ctx /*ctx*/);

int
hx509_validate_ctx_init (
	hx509_context /*context*/,
	hx509_validate_ctx */*ctx*/);

void
hx509_validate_ctx_set_print (
	hx509_validate_ctx /*ctx*/,
	hx509_vprint_func /*func*/,
	void */*c*/);

void
hx509_verify_attach_anchors (
	hx509_verify_ctx /*ctx*/,
	hx509_certs /*set*/);

void
hx509_verify_attach_revoke (
	hx509_verify_ctx /*ctx*/,
	hx509_revoke_ctx /*revoke_ctx*/);

void
hx509_verify_ctx_f_allow_default_trustanchors (
	hx509_verify_ctx /*ctx*/,
	int /*boolean*/);

void
hx509_verify_destroy_ctx (hx509_verify_ctx /*ctx*/);

int
hx509_verify_hostname (
	hx509_context /*context*/,
	const hx509_cert /*cert*/,
	int /*flags*/,
	hx509_hostname_type /*type*/,
	const char */*hostname*/,
	const struct sockaddr */*sa*/,
	int /*sa_size*/);

int
hx509_verify_init_ctx (
	hx509_context /*context*/,
	hx509_verify_ctx */*ctx*/);

int
hx509_verify_path (
	hx509_context /*context*/,
	hx509_verify_ctx /*ctx*/,
	hx509_cert /*cert*/,
	hx509_certs /*pool*/);

void
hx509_verify_set_max_depth (
	hx509_verify_ctx /*ctx*/,
	unsigned int /*max_depth*/);

void
hx509_verify_set_proxy_certificate (
	hx509_verify_ctx /*ctx*/,
	int /*boolean*/);

void
hx509_verify_set_strict_rfc3280_verification (
	hx509_verify_ctx /*ctx*/,
	int /*boolean*/);

void
hx509_verify_set_time (
	hx509_verify_ctx /*ctx*/,
	time_t /*t*/);

int
hx509_verify_signature (
	hx509_context /*context*/,
	const hx509_cert /*signer*/,
	const AlgorithmIdentifier */*alg*/,
	const heim_octet_string */*data*/,
	const heim_octet_string */*sig*/);

void
hx509_xfree (void */*ptr*/);

#ifdef __cplusplus
}
#endif

#endif /* __hx509_protos_h__ */


code:
/*
 * Copyright (c) 2004 - 2007 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: hx509.h 22464 2008-01-16 14:24:50Z lha $ */

typedef struct hx509_cert_attribute_data *hx509_cert_attribute;
typedef struct hx509_cert_data *hx509_cert;
typedef struct hx509_certs_data *hx509_certs;
typedef struct hx509_context_data *hx509_context;
typedef struct hx509_crypto_data *hx509_crypto;
typedef struct hx509_lock_data *hx509_lock;
typedef struct hx509_name_data *hx509_name;
typedef struct hx509_private_key *hx509_private_key;
typedef struct hx509_validate_ctx_data *hx509_validate_ctx;
typedef struct hx509_verify_ctx_data *hx509_verify_ctx;
typedef struct hx509_revoke_ctx_data *hx509_revoke_ctx;
typedef struct hx509_query_data hx509_query;
typedef void * hx509_cursor;
typedef struct hx509_request_data *hx509_request;
typedef struct hx509_error_data *hx509_error;
typedef struct hx509_peer_info *hx509_peer_info;
typedef struct hx509_ca_tbs *hx509_ca_tbs;
typedef struct hx509_env *hx509_env;
typedef struct hx509_crl *hx509_crl;

typedef void (*hx509_vprint_func)(void *, const char *, va_list);

enum {
    HX509_VHN_F_ALLOW_NO_MATCH = 1
};

enum {
    HX509_VALIDATE_F_VALIDATE = 1,
    HX509_VALIDATE_F_VERBOSE = 2
};

struct hx509_cert_attribute_data {
    heim_oid oid;
    heim_octet_string data;
};

typedef enum {
    HX509_PROMPT_TYPE_PASSWORD		= 0x1,	/* password, hidden */
    HX509_PROMPT_TYPE_QUESTION		= 0x2,	/* question, not hidden */
    HX509_PROMPT_TYPE_INFO		= 0x4	/* infomation, reply doesn't matter */
} hx509_prompt_type;

typedef struct hx509_prompt {
    const char *prompt;
    hx509_prompt_type type;
    heim_octet_string reply;
} hx509_prompt;

typedef int (*hx509_prompter_fct)(void *, const hx509_prompt *);

typedef struct hx509_octet_string_list {
    size_t len;
    heim_octet_string *val;
} hx509_octet_string_list;

typedef struct hx509_pem_header {
    struct hx509_pem_header *next;
    char *header;
    char *value;
} hx509_pem_header;

typedef int
(*hx509_pem_read_func)(hx509_context, const char *, const hx509_pem_header *,
		       const void *, size_t, void *ctx);

/*
 * Options passed to hx509_query_match_option.
 */
typedef enum {
    HX509_QUERY_OPTION_PRIVATE_KEY = 1,
    HX509_QUERY_OPTION_KU_ENCIPHERMENT = 2,
    HX509_QUERY_OPTION_KU_DIGITALSIGNATURE = 3,
    HX509_QUERY_OPTION_KU_KEYCERTSIGN = 4,
    HX509_QUERY_OPTION_END = 0xffff
} hx509_query_option;

/* flags to hx509_certs_init */
#define HX509_CERTS_CREATE				0x01
#define HX509_CERTS_UNPROTECT_ALL			0x02

/* flags to hx509_set_error_string */
#define HX509_ERROR_APPEND				0x01

/* flags to hx509_cms_unenvelope */
#define HX509_CMS_UE_DONT_REQUIRE_KU_ENCIPHERMENT	0x01

/* selectors passed to hx509_crypto_select and hx509_crypto_available */
#define HX509_SELECT_ALL 0
#define HX509_SELECT_DIGEST 1
#define HX509_SELECT_PUBLIC_SIG 2
#define HX509_SELECT_PUBLIC_ENC 3
#define HX509_SELECT_SECRET_ENC 4

/* flags to hx509_ca_tbs_set_template */
#define HX509_CA_TEMPLATE_SUBJECT 1
#define HX509_CA_TEMPLATE_SERIAL 2
#define HX509_CA_TEMPLATE_NOTBEFORE 4
#define HX509_CA_TEMPLATE_NOTAFTER 8
#define HX509_CA_TEMPLATE_SPKI 16
#define HX509_CA_TEMPLATE_KU 32
#define HX509_CA_TEMPLATE_EKU 64

/* flags hx509_cms_create_signed* */
#define HX509_CMS_SIGATURE_DETACHED 1
#define HX509_CMS_SIGATURE_ID_NAME 2

/* hx509_verify_hostname nametype */
typedef enum  {
    HX509_HN_HOSTNAME = 0,
    HX509_HN_DNSSRV
} hx509_hostname_type;

#include <hx509-protos.h>


code:
/* Generated from /usr/src/kerberos5/lib/libhx509/../../../crypto/heimdal/lib/hx509/hx509_err.et */
/* $Id: hx509_err.et 22329 2007-12-15 05:13:14Z lha $ */

#ifndef __hx509_err_h__
#define __hx509_err_h__

struct et_list;

void initialize_hx_error_table_r(struct et_list **);

void initialize_hx_error_table(void);
#define init_hx_err_tbl initialize_hx_error_table

typedef enum hx_error_number{
	HX509_BAD_TIMEFORMAT = 569856,
	HX509_EXTENSION_NOT_FOUND = 569857,
	HX509_NO_PATH = 569858,
	HX509_PARENT_NOT_CA = 569859,
	HX509_CA_PATH_TOO_DEEP = 569860,
	HX509_SIG_ALG_NO_SUPPORTED = 569861,
	HX509_SIG_ALG_DONT_MATCH_KEY_ALG = 569862,
	HX509_CERT_USED_BEFORE_TIME = 569863,
	HX509_CERT_USED_AFTER_TIME = 569864,
	HX509_PRIVATE_KEY_MISSING = 569865,
	HX509_ALG_NOT_SUPP = 569866,
	HX509_ISSUER_NOT_FOUND = 569867,
	HX509_VERIFY_CONSTRAINTS = 569868,
	HX509_RANGE = 569869,
	HX509_NAME_CONSTRAINT_ERROR = 569870,
	HX509_PATH_TOO_LONG = 569871,
	HX509_KU_CERT_MISSING = 569872,
	HX509_CERT_NOT_FOUND = 569873,
	HX509_UNKNOWN_LOCK_COMMAND = 569874,
	HX509_PARENT_IS_CA = 569875,
	HX509_EXTRA_DATA_AFTER_STRUCTURE = 569876,
	HX509_PROXY_CERT_INVALID = 569877,
	HX509_PROXY_CERT_NAME_WRONG = 569878,
	HX509_NAME_MALFORMED = 569879,
	HX509_CERTIFICATE_MALFORMED = 569880,
	HX509_CERTIFICATE_MISSING_EKU = 569881,
	HX509_PROXY_CERTIFICATE_NOT_CANONICALIZED = 569882,
	HX509_CMS_FAILED_CREATE_SIGATURE = 569888,
	HX509_CMS_MISSING_SIGNER_DATA = 569889,
	HX509_CMS_SIGNER_NOT_FOUND = 569890,
	HX509_CMS_NO_DATA_AVAILABLE = 569891,
	HX509_CMS_INVALID_DATA = 569892,
	HX509_CMS_PADDING_ERROR = 569893,
	HX509_CMS_NO_RECIPIENT_CERTIFICATE = 569894,
	HX509_CMS_DATA_OID_MISMATCH = 569895,
	HX509_CRYPTO_INTERNAL_ERROR = 569920,
	HX509_CRYPTO_EXTERNAL_ERROR = 569921,
	HX509_CRYPTO_SIGNATURE_MISSING = 569922,
	HX509_CRYPTO_BAD_SIGNATURE = 569923,
	HX509_CRYPTO_SIG_NO_CONF = 569924,
	HX509_CRYPTO_SIG_INVALID_FORMAT = 569925,
	HX509_CRYPTO_OID_MISMATCH = 569926,
	HX509_CRYPTO_NO_PROMPTER = 569927,
	HX509_CRYPTO_SIGNATURE_WITHOUT_SIGNER = 569928,
	HX509_CRYPTO_RSA_PUBLIC_ENCRYPT = 569929,
	HX509_CRYPTO_RSA_PRIVATE_ENCRYPT = 569930,
	HX509_CRYPTO_RSA_PUBLIC_DECRYPT = 569931,
	HX509_CRYPTO_RSA_PRIVATE_DECRYPT = 569932,
	HX509_CRL_USED_BEFORE_TIME = 569952,
	HX509_CRL_USED_AFTER_TIME = 569953,
	HX509_CRL_INVALID_FORMAT = 569954,
	HX509_CERT_REVOKED = 569955,
	HX509_REVOKE_STATUS_MISSING = 569956,
	HX509_CRL_UNKNOWN_EXTENSION = 569957,
	HX509_REVOKE_WRONG_DATA = 569958,
	HX509_REVOKE_NOT_SAME_PARENT = 569959,
	HX509_CERT_NOT_IN_OCSP = 569960,
	HX509_LOCAL_ATTRIBUTE_MISSING = 569964,
	HX509_PARSING_KEY_FAILED = 569965,
	HX509_UNSUPPORTED_OPERATION = 569966,
	HX509_UNIMPLEMENTED_OPERATION = 569967,
	HX509_PARSING_NAME_FAILED = 569968,
	HX509_PKCS11_NO_SLOT = 569984,
	HX509_PKCS11_NO_TOKEN = 569985,
	HX509_PKCS11_NO_MECH = 569986,
	HX509_PKCS11_TOKEN_CONFUSED = 569987,
	HX509_PKCS11_OPEN_SESSION = 569988,
	HX509_PKCS11_LOGIN = 569989,
	HX509_PKCS11_LOAD = 569990
} hx_error_number;

#define ERROR_TABLE_BASE_hx 569856

#endif /* __hx509_err_h__ */


code:
/*	$NetBSD: ieeefp.h,v 1.4 1998/01/09 08:03:43 perry Exp $	*/
/* $FreeBSD: release/9.0.0/include/ieeefp.h 109520 2003-01-19 06:01:33Z marcel $ */

/*
 * Written by J.T. Conklin, Apr 6, 1995
 * Public domain.
 */

#ifndef _IEEEFP_H_
#define _IEEEFP_H_

#include <sys/cdefs.h>
#include <machine/ieeefp.h>

#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_ */


code:
/*	$FreeBSD: release/9.0.0/include/ifaddrs.h 122687 2003-11-14 18:53:22Z bms $	*/

/*
 * 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 <net/if.h>.  Note that if <net/if.h> 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 <sys/cdefs.h>

__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


code:
/*-
 * Copyright (c) 2001 Mike Barcroft <mike@FreeBSD.org>
 * 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: release/9.0.0/include/inttypes.h 205954 2010-03-31 02:12:24Z jmallett $
 */

#ifndef _INTTYPES_H_
#define	_INTTYPES_H_

#include <machine/_inttypes.h>
#include <sys/stdint.h>

#ifndef	__cplusplus
#ifndef _WCHAR_T_DECLARED
typedef	__wchar_t	wchar_t;
#define	_WCHAR_T_DECLARED
#endif
#endif

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_ */


code:
/*-
 * 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: release/9.0.0/include/iso646.h 226036 2011-10-05 15:50:05Z jkim $
 */

#ifndef _ISO646_H_
#define	_ISO646_H_

#ifndef __cplusplus

#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 /* !__cplusplus */

#endif /* !_ISO646_H_ */


code:
/*-
 * Copyright (c) 1995
 *	The Regents of the University of California.  All rights reserved.
 *
 * This code is derived from software contributed to Berkeley
 * by Pace Willisson (pace@blitz.com).  The Rock Ridge Extension
 * Support code is derived from software contributed to Berkeley
 * by Atsushi Murai (amurai@spec.co.jp).
 *
 * Redistribution and use in source 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.
 *
 *	@(#)cd9660_mount.h	8.1 (Berkeley) 5/24/95
 * $FreeBSD: release/9.0.0/sys/fs/cd9660/cd9660_mount.h 213664 2010-10-10 07:05:47Z kib $
 */

/*
 * Arguments to mount ISO 9660 filesystems.
 */
struct iso_args {
	char	*fspec;			/* block special device to mount */
	struct	oexport_args export;	/* network export info */
	int	flags;			/* mounting flags, see below */
	int	ssector;		/* starting sector, 0 for 1st session */
	char	*cs_disk;		/* disk charset for Joliet cs conversion */
	char	*cs_local;		/* local charset for Joliet cs conversion */
};
#define	ISOFSMNT_NORRIP	0x00000001	/* disable Rock Ridge Ext.*/
#define	ISOFSMNT_GENS	0x00000002	/* enable generation numbers */
#define	ISOFSMNT_EXTATT	0x00000004	/* enable extended attributes */
#define ISOFSMNT_NOJOLIET 0x00000008	/* disable Joliet Ext.*/
#define ISOFSMNT_BROKENJOLIET 0x00000010/* allow broken Joliet disks */
#define	ISOFSMNT_KICONV 0x00000020	/* Use libiconv to convert chars */


code:
/*-
 * Copyright (c) 1994
 *	The Regents of the University of California.  All rights reserved.
 *
 * This code is derived from software contributed to Berkeley
 * by Pace Willisson (pace@blitz.com).  The Rock Ridge Extension
 * Support code is derived from software contributed to Berkeley
 * by Atsushi Murai (amurai@spec.co.jp).
 *
 * Redistribution and use in source 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.
 *
 *	@(#)cd9660_node.h	8.6 (Berkeley) 5/14/95
 * $FreeBSD: release/9.0.0/sys/fs/cd9660/cd9660_node.h 187838 2009-01-28 18:54:56Z jhb $
 */

/*
 * Theoretically, directories can be more than 2Gb in length,
 * however, in practice this seems unlikely. So, we define
 * the type doff_t as a long to keep down the cost of doing
 * lookup on a 32-bit machine. If you are porting to a 64-bit
 * architecture, you should make doff_t the same as off_t.
 */
#define doff_t	long

typedef	struct	{
	struct timespec	iso_atime;	/* time of last access */
	struct timespec	iso_mtime;	/* time of last modification */
	struct timespec	iso_ctime;	/* time file changed */
	u_short		iso_mode;	/* files access mode and type */
	uid_t		iso_uid;	/* owner user id */
	gid_t		iso_gid;	/* owner group id */
	short		iso_links;	/* links of file */
	dev_t		iso_rdev;	/* Major/Minor number for special */
} ISO_RRIP_INODE;

struct iso_node {
	struct	vnode *i_vnode;	/* vnode associated with this inode */
	ino_t	i_number;	/* the identity of the inode */
				/* we use the actual starting block of the file */
	struct	iso_mnt *i_mnt;	/* filesystem associated with this inode */
	struct	lockf *i_lockf;	/* head of byte-level lock list */
	doff_t	i_endoff;	/* end of useful stuff in directory */
	doff_t	i_diroff;	/* offset in dir, where we found last entry */

	long iso_extent;	/* extent of file */
	unsigned long i_size;
	long iso_start;		/* actual start of data of file (may be different */
				/* from iso_extent, if file has extended attributes) */
	ISO_RRIP_INODE	inode;
};

#define	i_forw		i_chain[0]
#define	i_back		i_chain[1]

#define VTOI(vp) ((struct iso_node *)(vp)->v_data)
#define ITOV(ip) ((ip)->i_vnode)

#ifdef _KERNEL

#ifdef MALLOC_DECLARE
MALLOC_DECLARE(M_ISOFSMNT);
MALLOC_DECLARE(M_ISOFSNODE);
#endif

struct buf;
struct vop_bmap_args;
struct vop_cachedlookup_args;
struct vop_inactive_args;
struct vop_reclaim_args;

/*
 * Prototypes for ISOFS vnode operations
 */
int cd9660_lookup(struct vop_cachedlookup_args *);
int cd9660_inactive(struct vop_inactive_args *);
int cd9660_reclaim(struct vop_reclaim_args *);
int cd9660_bmap(struct vop_bmap_args *);
int cd9660_blkatoff(struct vnode *vp, off_t offset, char **res, struct buf **bpp);

void cd9660_defattr(struct iso_directory_record *,
			struct iso_node *, struct buf *, enum ISO_FTYPE);
void cd9660_deftstamp(struct iso_directory_record *,
			struct iso_node *, struct buf *, enum ISO_FTYPE);
int cd9660_tstamp_conv7(u_char *, struct timespec *, enum ISO_FTYPE);
int cd9660_tstamp_conv17(u_char *, struct timespec *);

#endif /* _KERNEL */


code:
/*-
 * Copyright (c) 1993, 1994
 *	The Regents of the University of California.  All rights reserved.
 *
 * This code is derived from software contributed to Berkeley
 * by Pace Willisson (pace@blitz.com).  The Rock Ridge Extension
 * Support code is derived from software contributed to Berkeley
 * by Atsushi Murai (amurai@spec.co.jp).
 *
 * Redistribution and use in source 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.
 *
 *	@(#)cd9660_rrip.h	8.2 (Berkeley) 12/5/94
 * $FreeBSD: release/9.0.0/sys/fs/cd9660/cd9660_rrip.h 166639 2007-02-11 13:54:25Z rodrigc $
 */

typedef struct {
	char   type			[ISODCL (  0,    1)];
	u_char length			[ISODCL (  2,    2)]; /* 711 */
	u_char version			[ISODCL (  3,    3)];
} ISO_SUSP_HEADER;

typedef struct {
	ISO_SUSP_HEADER			h;
	char mode			[ISODCL (  4,   11)]; /* 733 */
	char links			[ISODCL ( 12,   19)]; /* 733 */
	char uid			[ISODCL ( 20,   27)]; /* 733 */
	char gid			[ISODCL ( 28,   35)]; /* 733 */
} ISO_RRIP_ATTR;

typedef struct {
	ISO_SUSP_HEADER			h;
	char dev_t_high			[ISODCL (  4,   11)]; /* 733 */
	char dev_t_low			[ISODCL ( 12,   19)]; /* 733 */
} ISO_RRIP_DEVICE;

#define	ISO_SUSP_CFLAG_CONTINUE	0x01
#define	ISO_SUSP_CFLAG_CURRENT	0x02
#define	ISO_SUSP_CFLAG_PARENT	0x04
#define	ISO_SUSP_CFLAG_ROOT	0x08
#define	ISO_SUSP_CFLAG_VOLROOT	0x10
#define	ISO_SUSP_CFLAG_HOST	0x20

typedef struct {
	u_char cflag			[ISODCL (  1,    1)];
	u_char clen			[ISODCL (  2,    2)];
	u_char name			[1];			/* XXX */
} ISO_RRIP_SLINK_COMPONENT;
#define	ISO_RRIP_SLSIZ	2

typedef struct {
	ISO_SUSP_HEADER			h;
	u_char flags			[ISODCL (  4,	 4)];
	u_char component		[ISODCL (  5,	 5)];
} ISO_RRIP_SLINK;

typedef struct {
	ISO_SUSP_HEADER			h;
	char flags			[ISODCL (  4,	 4)];
} ISO_RRIP_ALTNAME;

typedef struct {
	ISO_SUSP_HEADER			h;
	char dir_loc			[ISODCL (  4,	 11)]; /* 733 */
} ISO_RRIP_CLINK;

typedef struct {
	ISO_SUSP_HEADER			h;
	char dir_loc			[ISODCL (  4,	 11)]; /* 733 */
} ISO_RRIP_PLINK;

typedef struct {
	ISO_SUSP_HEADER			h;
} ISO_RRIP_RELDIR;

#define	ISO_SUSP_TSTAMP_FORM17	0x80
#define	ISO_SUSP_TSTAMP_FORM7	0x00
#define	ISO_SUSP_TSTAMP_CREAT	0x01
#define	ISO_SUSP_TSTAMP_MODIFY	0x02
#define	ISO_SUSP_TSTAMP_ACCESS	0x04
#define	ISO_SUSP_TSTAMP_ATTR	0x08
#define	ISO_SUSP_TSTAMP_BACKUP	0x10
#define	ISO_SUSP_TSTAMP_EXPIRE	0x20
#define	ISO_SUSP_TSTAMP_EFFECT	0x40

typedef struct {
	ISO_SUSP_HEADER			h;
	u_char flags			[ISODCL (  4,    4)];
	u_char time			[ISODCL (  5,    5)];
} ISO_RRIP_TSTAMP;

typedef struct {
	ISO_SUSP_HEADER			h;
	u_char flags			[ISODCL (  4,    4)];
} ISO_RRIP_IDFLAG;

typedef struct {
	ISO_SUSP_HEADER			h;
	char len_id			[ISODCL (  4,	 4)];
	char len_des			[ISODCL (  5,	 5)];
	char len_src			[ISODCL (  6,	 6)];
	char version			[ISODCL (  7,	 7)];
} ISO_RRIP_EXTREF;

typedef struct {
	ISO_SUSP_HEADER			h;
	char check			[ISODCL (  4,	 5)];
	char skip			[ISODCL (  6,	 6)];
} ISO_RRIP_OFFSET;

typedef struct {
	ISO_SUSP_HEADER			h;
	char location			[ISODCL (  4,	11)];
	char offset			[ISODCL ( 12,	19)];
	char length			[ISODCL ( 20,	27)];
} ISO_RRIP_CONT;


code:
/*-
 * Copyright (c) 1994
 *	The Regents of the University of California.  All rights reserved.
 *
 * This code is derived from software contributed to Berkeley
 * by Pace Willisson (pace@blitz.com).  The Rock Ridge Extension
 * Support code is derived from software contributed to Berkeley
 * by Atsushi Murai (amurai@spec.co.jp).
 *
 * Redistribution and use in source 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.
 *
 *	@(#)iso.h	8.6 (Berkeley) 5/10/95
 * $FreeBSD: release/9.0.0/sys/fs/cd9660/iso.h 224290 2011-07-24 17:43:09Z mckusick $
 */

#define ISODCL(from, to) (to - from + 1)

struct iso_volume_descriptor {
	char type[ISODCL(1,1)]; /* 711 */
	char id[ISODCL(2,6)];
	char version[ISODCL(7,7)];
	char unused[ISODCL(8,8)];
	char type_sierra[ISODCL(9,9)]; /* 711 */
	char id_sierra[ISODCL(10,14)];
	char version_sierra[ISODCL(15,15)];
	char data[ISODCL(16,2048)];
};

/* volume descriptor types */
#define ISO_VD_PRIMARY 1
#define ISO_VD_SUPPLEMENTARY 2
#define ISO_VD_END 255

#define ISO_STANDARD_ID "CD001"
#define ISO_ECMA_ID	"CDW01"

#define ISO_SIERRA_ID	"CDROM"

struct iso_primary_descriptor {
	char type			[ISODCL (  1,	1)]; /* 711 */
	char id				[ISODCL (  2,	6)];
	char version			[ISODCL (  7,	7)]; /* 711 */
	char unused1			[ISODCL (  8,	8)];
	char system_id			[ISODCL (  9,  40)]; /* achars */
	char volume_id			[ISODCL ( 41,  72)]; /* dchars */
	char unused2			[ISODCL ( 73,  80)];
	char volume_space_size		[ISODCL ( 81,  88)]; /* 733 */
	char unused3			[ISODCL ( 89, 120)];
	char volume_set_size		[ISODCL (121, 124)]; /* 723 */
	char volume_sequence_number	[ISODCL (125, 128)]; /* 723 */
	char logical_block_size		[ISODCL (129, 132)]; /* 723 */
	char path_table_size		[ISODCL (133, 140)]; /* 733 */
	char type_l_path_table		[ISODCL (141, 144)]; /* 731 */
	char opt_type_l_path_table	[ISODCL (145, 148)]; /* 731 */
	char type_m_path_table		[ISODCL (149, 152)]; /* 732 */
	char opt_type_m_path_table	[ISODCL (153, 156)]; /* 732 */
	char root_directory_record	[ISODCL (157, 190)]; /* 9.1 */
	char volume_set_id		[ISODCL (191, 318)]; /* dchars */
	char publisher_id		[ISODCL (319, 446)]; /* achars */
	char preparer_id		[ISODCL (447, 574)]; /* achars */
	char application_id		[ISODCL (575, 702)]; /* achars */
	char copyright_file_id		[ISODCL (703, 739)]; /* 7.5 dchars */
	char abstract_file_id		[ISODCL (740, 776)]; /* 7.5 dchars */
	char bibliographic_file_id	[ISODCL (777, 813)]; /* 7.5 dchars */
	char creation_date		[ISODCL (814, 830)]; /* 8.4.26.1 */
	char modification_date		[ISODCL (831, 847)]; /* 8.4.26.1 */
	char expiration_date		[ISODCL (848, 864)]; /* 8.4.26.1 */
	char effective_date		[ISODCL (865, 881)]; /* 8.4.26.1 */
	char file_structure_version	[ISODCL (882, 882)]; /* 711 */
	char unused4			[ISODCL (883, 883)];
	char application_data		[ISODCL (884, 1395)];
	char unused5			[ISODCL (1396, 2048)];
};
#define ISO_DEFAULT_BLOCK_SIZE		2048

/*
 * Used by Microsoft Joliet extension to ISO9660. Almost the same
 * as PVD, but byte position 8 is a flag, and 89-120 is for escape.
 */

struct iso_supplementary_descriptor {
      char type                       [ISODCL (  1,   1)]; /* 711 */
      char id                         [ISODCL (  2,   6)];
      char version                    [ISODCL (  7,   7)]; /* 711 */
      char flags                      [ISODCL (  8,   8)]; /* 711? */
      char system_id                  [ISODCL (  9,  40)]; /* achars */
      char volume_id                  [ISODCL ( 41,  72)]; /* dchars */
      char unused2                    [ISODCL ( 73,  80)];
      char volume_space_size          [ISODCL ( 81,  88)]; /* 733 */
      char escape                     [ISODCL ( 89, 120)];
      char volume_set_size            [ISODCL (121, 124)]; /* 723 */
      char volume_sequence_number     [ISODCL (125, 128)]; /* 723 */
      char logical_block_size         [ISODCL (129, 132)]; /* 723 */
      char path_table_size            [ISODCL (133, 140)]; /* 733 */
      char type_l_path_table          [ISODCL (141, 144)]; /* 731 */
      char opt_type_l_path_table      [ISODCL (145, 148)]; /* 731 */
      char type_m_path_table          [ISODCL (149, 152)]; /* 732 */
      char opt_type_m_path_table      [ISODCL (153, 156)]; /* 732 */
      char root_directory_record      [ISODCL (157, 190)]; /* 9.1 */
      char volume_set_id              [ISODCL (191, 318)]; /* dchars */
      char publisher_id               [ISODCL (319, 446)]; /* achars */
      char preparer_id                [ISODCL (447, 574)]; /* achars */
      char application_id             [ISODCL (575, 702)]; /* achars */
      char copyright_file_id          [ISODCL (703, 739)]; /* 7.5 dchars */
      char abstract_file_id           [ISODCL (740, 776)]; /* 7.5 dchars */
      char bibliographic_file_id      [ISODCL (777, 813)]; /* 7.5 dchars */
      char creation_date              [ISODCL (814, 830)]; /* 8.4.26.1 */
      char modification_date          [ISODCL (831, 847)]; /* 8.4.26.1 */
      char expiration_date            [ISODCL (848, 864)]; /* 8.4.26.1 */
      char effective_date             [ISODCL (865, 881)]; /* 8.4.26.1 */
      char file_structure_version     [ISODCL (882, 882)]; /* 711 */
      char unused4                    [ISODCL (883, 883)];
      char application_data           [ISODCL (884, 1395)];
      char unused5                    [ISODCL (1396, 2048)];
};

struct iso_sierra_primary_descriptor {
	char unknown1			[ISODCL (  1,	8)]; /* 733 */
	char type			[ISODCL (  9,	9)]; /* 711 */
	char id				[ISODCL ( 10,  14)];
	char version			[ISODCL ( 15,  15)]; /* 711 */
	char unused1			[ISODCL ( 16,  16)];
	char system_id			[ISODCL ( 17,  48)]; /* achars */
	char volume_id			[ISODCL ( 49,  80)]; /* dchars */
	char unused2			[ISODCL ( 81,  88)];
	char volume_space_size		[ISODCL ( 89,  96)]; /* 733 */
	char unused3			[ISODCL ( 97, 128)];
	char volume_set_size		[ISODCL (129, 132)]; /* 723 */
	char volume_sequence_number	[ISODCL (133, 136)]; /* 723 */
	char logical_block_size		[ISODCL (137, 140)]; /* 723 */
	char path_table_size		[ISODCL (141, 148)]; /* 733 */
	char type_l_path_table		[ISODCL (149, 152)]; /* 731 */
	char opt_type_l_path_table	[ISODCL (153, 156)]; /* 731 */
	char unknown2			[ISODCL (157, 160)]; /* 731 */
	char unknown3			[ISODCL (161, 164)]; /* 731 */
	char type_m_path_table		[ISODCL (165, 168)]; /* 732 */
	char opt_type_m_path_table	[ISODCL (169, 172)]; /* 732 */
	char unknown4			[ISODCL (173, 176)]; /* 732 */
	char unknown5			[ISODCL (177, 180)]; /* 732 */
	char root_directory_record	[ISODCL (181, 214)]; /* 9.1 */
	char volume_set_id		[ISODCL (215, 342)]; /* dchars */
	char publisher_id		[ISODCL (343, 470)]; /* achars */
	char preparer_id		[ISODCL (471, 598)]; /* achars */
	char application_id		[ISODCL (599, 726)]; /* achars */
	char copyright_id		[ISODCL (727, 790)]; /* achars */
	char creation_date		[ISODCL (791, 806)]; /* ? */
	char modification_date		[ISODCL (807, 822)]; /* ? */
	char expiration_date		[ISODCL (823, 838)]; /* ? */
	char effective_date		[ISODCL (839, 854)]; /* ? */
	char file_structure_version	[ISODCL (855, 855)]; /* 711 */
	char unused4			[ISODCL (856, 2048)];
};

struct iso_directory_record {
	char length			[ISODCL (1, 1)]; /* 711 */
	char ext_attr_length		[ISODCL (2, 2)]; /* 711 */
	u_char extent			[ISODCL (3, 10)]; /* 733 */
	u_char size			[ISODCL (11, 18)]; /* 733 */
	char date			[ISODCL (19, 25)]; /* 7 by 711 */
	char flags			[ISODCL (26, 26)];
	char file_unit_size		[ISODCL (27, 27)]; /* 711 */
	char interleave			[ISODCL (28, 28)]; /* 711 */
	char volume_sequence_number	[ISODCL (29, 32)]; /* 723 */
	char name_len			[ISODCL (33, 33)]; /* 711 */
	char name			[1];			/* XXX */
};
/* can't take sizeof(iso_directory_record), because of possible alignment
   of the last entry (34 instead of 33) */
#define ISO_DIRECTORY_RECORD_SIZE	33

struct iso_extended_attributes {
	u_char owner			[ISODCL (1, 4)]; /* 723 */
	u_char group			[ISODCL (5, 8)]; /* 723 */
	u_char perm			[ISODCL (9, 10)]; /* 9.5.3 */
	char ctime			[ISODCL (11, 27)]; /* 8.4.26.1 */
	char mtime			[ISODCL (28, 44)]; /* 8.4.26.1 */
	char xtime			[ISODCL (45, 61)]; /* 8.4.26.1 */
	char ftime			[ISODCL (62, 78)]; /* 8.4.26.1 */
	char recfmt			[ISODCL (79, 79)]; /* 711 */
	char recattr			[ISODCL (80, 80)]; /* 711 */
	u_char reclen			[ISODCL (81, 84)]; /* 723 */
	char system_id			[ISODCL (85, 116)]; /* achars */
	char system_use			[ISODCL (117, 180)];
	char version			[ISODCL (181, 181)]; /* 711 */
	char len_esc			[ISODCL (182, 182)]; /* 711 */
	char reserved			[ISODCL (183, 246)];
	u_char len_au			[ISODCL (247, 250)]; /* 723 */
};

#ifdef _KERNEL

/* CD-ROM Format type */
enum ISO_FTYPE	{ ISO_FTYPE_DEFAULT, ISO_FTYPE_9660, ISO_FTYPE_RRIP,
		  ISO_FTYPE_JOLIET, ISO_FTYPE_ECMA, ISO_FTYPE_HIGH_SIERRA };

#ifndef	ISOFSMNT_ROOT
#define	ISOFSMNT_ROOT	0
#endif

struct iso_mnt {
	uint64_t im_flags;

	struct mount *im_mountp;
	struct cdev *im_dev;
	struct vnode *im_devvp;

	struct g_consumer *im_cp;
	struct bufobj *im_bo;

	int logical_block_size;
	int im_bshift;
	int im_bmask;

	int volume_space_size;

	char root[ISODCL (157, 190)];
	int root_extent;
	int root_size;
	enum ISO_FTYPE	iso_ftype;

	int rr_skip;
	int rr_skip0;

	int joliet_level;

	void *im_d2l;
	void *im_l2d;
};

struct ifid {
	u_short	ifid_len;
	u_short	ifid_pad;
	int	ifid_ino;
	long	ifid_start;
};

#define VFSTOISOFS(mp)	((struct iso_mnt *)((mp)->mnt_data))

#define blkoff(imp, loc)	((loc) & (imp)->im_bmask)
#define lblktosize(imp, blk)	((blk) << (imp)->im_bshift)
#define lblkno(imp, loc)	((loc) >> (imp)->im_bshift)
#define blksize(imp, ip, lbn)	((imp)->logical_block_size)

int cd9660_vget_internal(struct mount *, ino_t, int, struct vnode **, int,
			 struct iso_directory_record *);
#define cd9660_sysctl ((int (*)(int *, u_int, void *, size_t *, void *, \
				size_t, struct proc *))eopnotsupp)

extern struct vop_vector cd9660_vnodeops;
extern struct vop_vector cd9660_fifoops;

int isochar(u_char *, u_char *, int, u_short *, int *, int, void *);
int isofncmp(u_char *, int, u_char *, int, int, int, void *, void *);
void isofntrans(u_char *, int, u_char *, u_short *, int, int, int, int, void *);
ino_t isodirino(struct iso_directory_record *, struct iso_mnt *);
u_short sgetrune(const char *, size_t, char const **, int, void *);

#endif /* _KERNEL */

/*
 * The isonum_xxx functions are inlined anyway, and could come handy even
 * outside the kernel.  Thus we don't hide them here.
 */

/*
 * 7xy
 *  x -> 1 = 8 bits, 2 = 16 bits, 3 = 32 bits
 *   y -> 1 = little-endian, 2 = big-endian, 3 = both (le then be)
 */

static __inline uint8_t
isonum_711(unsigned char *p)
{
	return p[0];
}

static __inline uint8_t
isonum_712(unsigned char *p)
{
	return p[0];
}

static __inline uint8_t
isonum_713(unsigned char *p)
{
	return p[0];
}

static __inline uint16_t
isonum_721(unsigned char *p)
{
	return (p[0] | p[1] << 8);
}

static __inline uint16_t
isonum_722(unsigned char *p)
{
	return (p[1] | p[0] << 8);
}

static __inline uint16_t
isonum_723(unsigned char *p)
{
	return (p[0] | p[1] << 8);
}

static __inline uint32_t
isonum_731(unsigned char *p)
{
	return (p[0] | p[1] << 8 | p[2] << 16 | p[3] << 24);
}

static __inline uint32_t
isonum_732(unsigned char *p)
{
	return (p[3] | p[2] << 8 | p[1] << 16 | p[0] << 24);
}

static __inline uint32_t
isonum_733(unsigned char *p)
{
	return (p[0] | p[1] << 8 | p[2] << 16 | p[3] << 24);
}

/*
 * Associated files have a leading '='.
 */
#define	ASSOCCHAR	'='


code:
/*-
 * Copyright (c) 1993, 1994
 *	The Regents of the University of California.  All rights reserved.
 *
 * This code is derived from software contributed to Berkeley
 * by Pace Willisson (pace@blitz.com).  The Rock Ridge Extension
 * Support code is derived from software contributed to Berkeley
 * by Atsushi Murai (amurai@spec.co.jp).
 *
 * Redistribution and use in source 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.
 *
 *	@(#)iso_rrip.h	8.2 (Berkeley) 1/23/94
 * $FreeBSD: release/9.0.0/sys/fs/cd9660/iso_rrip.h 166639 2007-02-11 13:54:25Z rodrigc $
 */

/*
 *	Analyze function flag (similar to RR field bits)
 */
#define	ISO_SUSP_ATTR		0x0001
#define	ISO_SUSP_DEVICE		0x0002
#define	ISO_SUSP_SLINK		0x0004
#define	ISO_SUSP_ALTNAME	0x0008
#define	ISO_SUSP_CLINK		0x0010
#define	ISO_SUSP_PLINK		0x0020
#define	ISO_SUSP_RELDIR		0x0040
#define	ISO_SUSP_TSTAMP		0x0080
#define	ISO_SUSP_IDFLAG		0x0100
#define	ISO_SUSP_EXTREF		0x0200
#define	ISO_SUSP_CONT		0x0400
#define	ISO_SUSP_OFFSET		0x0800
#define	ISO_SUSP_STOP		0x1000
#define	ISO_SUSP_UNKNOWN	0x8000

typedef struct {
	struct iso_node	*inop;
	int		fields;		/* interesting fields in this analysis */
	daddr_t		iso_ce_blk;	/* block of continuation area */
	off_t		iso_ce_off;	/* offset of continuation area */
	int		iso_ce_len;	/* length of continuation area */
	struct iso_mnt	*imp;		/* mount structure */
	ino_t		*inump;		/* inode number pointer */
	char		*outbuf;	/* name/symbolic link output area */
	u_short		*outlen;	/* length of above */
	u_short		maxlen;		/* maximum length of above */
	int		cont;		/* continuation of above */
} ISO_RRIP_ANALYZE;

struct iso_directory_record;

int cd9660_rrip_analyze(struct iso_directory_record *isodir,
			    struct iso_node *inop, struct iso_mnt *imp);
int cd9660_rrip_getname(struct iso_directory_record *isodir,
			    char *outbuf, u_short *outlen,
			    ino_t *inump, struct iso_mnt *imp);
int cd9660_rrip_getsymname(struct iso_directory_record *isodir,
			       char *outbuf, u_short *outlen,
			       struct iso_mnt *imp);
int cd9660_rrip_offset(struct iso_directory_record *isodir,
			   struct iso_mnt *imp);


code:
/*-
 * Copyright (c) 2009 James Gritton.
 * 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: release/9.0.0/lib/libjail/jail.h 195870 2009-07-25 14:48:57Z jamie $
 */

#ifndef _JAIL_H
#define _JAIL_H

#define	JP_RAWVALUE	0x01
#define	JP_BOOL		0x02
#define	JP_NOBOOL	0x04
#define	JP_JAILSYS	0x08

#define JAIL_ERRMSGLEN	1024

extern char jail_errmsg[];

struct jailparam {
	char		*jp_name;
	void		*jp_value;
	size_t		 jp_valuelen;
	size_t		 jp_elemlen;
	int		 jp_ctltype;
	int		 jp_structtype;
	unsigned	 jp_flags;
};

__BEGIN_DECLS
extern int jail_getid(const char *name);
extern char *jail_getname(int jid);
extern int jail_setv(int flags, ...);
extern int jail_getv(int flags, ...);
extern int jailparam_all(struct jailparam **jpp);
extern int jailparam_init(struct jailparam *jp, const char *name);
extern int jailparam_import(struct jailparam *jp, const char *value);
extern int jailparam_import_raw(struct jailparam *jp, void *value,
	       size_t valuelen);
extern int jailparam_set(struct jailparam *jp, unsigned njp, int flags);
extern int jailparam_get(struct jailparam *jp, unsigned njp, int flags);
extern char *jailparam_export(struct jailparam *jp);
extern void jailparam_free(struct jailparam *jp, unsigned njp);
__END_DECLS

#endif /* _JAIL_H  */


code:
/* Generated from /usr/src/kerberos5/lib/libkrb5/../../../crypto/heimdal/lib/krb5/k524_err.et */
/* $Id: k524_err.et 10141 2001-06-20 02:45:58Z joda $ */

#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__ */