/*
 * rxkad.h:
 * This file is automatically generated; please do not edit it.
 */
/* Including ./rxkad.p.h at beginning of rxkad.h file. */

/*
 * Copyright 2000, International Business Machines Corporation and others.
 * All Rights Reserved.
 *
 * This software has been released under the terms of the IBM Public
 * License.  For details, see the LICENSE file in the top-level source
 * directory or online at http://www.openafs.org/dl/license10.html
 */

/* The Kerberos Authenticated DES security object. */


#ifndef OPENAFS_RXKAD_RXKAD_H
#define OPENAFS_RXKAD_RXKAD_H

		/* no ticket good for longer than 30 days */
#define MAXKTCTICKETLIFETIME (30*24*3600)
#define MINKTCTICKETLEN	      32
#define	MAXKTCTICKETLEN	      12000	/* was 344 */

#define	MAXKTCNAMELEN	      64	/* name & inst should be 256 */
#define MAXKTCREALMLEN	      64	/* should be 256 */
#define KTC_TIME_UNCERTAINTY (15*60)	/* max skew bet. machines' clocks */

#define MAXRANDOMNAMELEN 16	/* length of random generated
				 * usernames used by afslog for high
				 * security must be < MAXKTCNAMELEN && < MAXSMBNAMELEN */
#define MAXSMBNAMELEN    256	/* max length of an SMB name */

#define LOGON_OPTION_INTEGRATED 1

/*
 * Define ticket types. For Kerberos V4 tickets, this is overloaded as
 * the server key version number, so class numbers 0 through 255 are reserved
 * for V4 tickets. For Kerberos V5, tickets have an in-the-clear portion
 * containing the server key version, so we only use a single type number to
 * identify those tickets. The ticket type is carried in the kvno field
 * passed to/from ktc_[SG]etToken.
 */
#define RXKAD_TKT_TYPE_KERBEROS_V5		256
#define RXKAD_TKT_TYPE_KERBEROS_V5_ENCPART_ONLY	213

#define MAXKRB5TICKETLEN		   MAXKTCTICKETLEN

/*
 * The AFS/DFS translator may also make use of additional ticket types in
 * the range 257 through 511. DO NOT USE THESE FOR ANY OTHER PURPOSE.
 */
#define RXKAD_TKT_TYPE_ADAPT_RESERVED_MIN	257
#define RXKAD_TKT_TYPE_ADAPT_RESERVED_MAX	511

struct ktc_encryptionKey {
    char data[8];
};

struct ktc_principal {
    char name[MAXKTCNAMELEN];
    char instance[MAXKTCNAMELEN];
    char cell[MAXKTCREALMLEN];
#ifdef AFS_NT40_ENV
    char smbname[MAXSMBNAMELEN];
#endif
};

#ifndef NEVERDATE
#define NEVERDATE 0xffffffff
#endif

/* this function round a length to the correct encryption block size */
#define round_up_to_ebs(v) (((v) + 7) & (~7))

typedef char rxkad_type;
#define rxkad_client 1		/* bits definitions */
#define rxkad_server 2

typedef signed char rxkad_level;
#define rxkad_clear 0		/* send packets in the clear */
#define rxkad_auth 1		/* send encrypted sequence numbers */
#define rxkad_crypt 2		/* encrypt packet data */

/* many stats are kept per type and per level.  These are encoded into an index
 * from 0 to 5 by the StatIndex macro. */

#define rxkad_StatIndex(type,level) \
    (((((type) == 1) || ((type) == 2)) && ((level) >= 0) && ((level) <= 2)) \
     ? (((level)<<1)+(type)-1) : 0)
#define rxkad_LevelIndex(level) \
    ((((level) >= 0) && ((level) <= 2)) ? (level) : 0)
#define rxkad_TypeIndex(type) \
    ((((type) == 1) || ((type) == 2)) ? ((type)-1) : 0)


/* Get key by enctype.  Takes a rock (path to conf dir), kvno and enctype as
 * input and returns the key and key length.  On input, the keylength parameter
 * must be set to the length of storage allocated by the caller. */
typedef int (*rxkad_get_key_enctype_func) (void *, int, int, void *, size_t *);

#include <rx/rxkad_prototypes.h>

#endif /* OPENAFS_RXKAD_RXKAD_H */

/* End of prolog file ./rxkad.p.h. */

#define RXKADINCONSISTENCY                       (19270400L)
#define RXKADPACKETSHORT                         (19270401L)
#define RXKADLEVELFAIL                           (19270402L)
#define RXKADTICKETLEN                           (19270403L)
#define RXKADOUTOFSEQUENCE                       (19270404L)
#define RXKADNOAUTH                              (19270405L)
#define RXKADBADKEY                              (19270406L)
#define RXKADBADTICKET                           (19270407L)
#define RXKADUNKNOWNKEY                          (19270408L)
#define RXKADEXPIRED                             (19270409L)
#define RXKADSEALEDINCON                         (19270410L)
#define RXKADDATALEN                             (19270411L)
#define RXKADILLEGALLEVEL                        (19270412L)
extern void initialize_RXK_error_table(void);
#define ERROR_TABLE_BASE_RXK (19270400L)

/* for compatibility with older versions... */
#define init_RXK_err_tbl initialize_RXK_error_table
#define RXK_err_base ERROR_TABLE_BASE_RXK

/* for compatibility with other users... */
#define ERROR_TABLE_BASE_rxk (19270400L)
#define init_rxk_err_tbl initialize_RXK_error_table
#define initialize_rxk_error_table initialize_RXK_error_table
#define rxk_err_base ERROR_TABLE_BASE_rxk
