endian-fixes-20060802
[openafs.git] / src / rxkad / rxkad.p.h
1 /*
2  * Copyright 2000, International Business Machines Corporation and others.
3  * All Rights Reserved.
4  * 
5  * This software has been released under the terms of the IBM Public
6  * License.  For details, see the LICENSE file in the top-level source
7  * directory or online at http://www.openafs.org/dl/license10.html
8  */
9
10 /* The Kerberos Authenticated DES security object. */
11
12
13 #ifndef OPENAFS_RXKAD_RXKAD_H
14 #define OPENAFS_RXKAD_RXKAD_H
15
16                 /* no ticket good for longer than 30 days */
17 #define MAXKTCTICKETLIFETIME (30*24*3600)
18 #define MINKTCTICKETLEN       32
19 #define MAXKTCTICKETLEN       12000     /* was 344 */
20
21 #define MAXKTCNAMELEN         64        /* name & inst should be 256 */
22 #define MAXKTCREALMLEN        64        /* should be 256 */
23 #define KTC_TIME_UNCERTAINTY (15*60)    /* max skew bet. machines' clocks */
24
25 #define MAXRANDOMNAMELEN 16     /* length of random generated 
26                                  * usernames used by afslog for high 
27                                  * security must be < MAXKTCNAMELEN && < MAXSMBNAMELEN */
28 #define MAXSMBNAMELEN    256    /* max length of an SMB name */
29
30 #define LOGON_OPTION_INTEGRATED 1
31 #define LOGON_OPTION_HIGHSECURITY 2
32
33 /*
34  * Define ticket types. For Kerberos V4 tickets, this is overloaded as
35  * the server key version number, so class numbers 0 through 255 are reserved
36  * for V4 tickets. For Kerberos V5, tickets have an in-the-clear portion
37  * containing the server key version, so we only use a single type number to
38  * identify those tickets. The ticket type is carried in the kvno field
39  * passed to/from ktc_[SG]etToken.
40  */
41 #define RXKAD_TKT_TYPE_KERBEROS_V5              256
42 #define RXKAD_TKT_TYPE_KERBEROS_V5_ENCPART_ONLY 213
43
44 #define MAXKRB5TICKETLEN                   MAXKTCTICKETLEN
45
46 /*
47  * The AFS/DFS translator may also make use of additional ticket types in
48  * the range 257 through 511. DO NOT USE THESE FOR ANY OTHER PURPOSE.
49  */
50 #define RXKAD_TKT_TYPE_ADAPT_RESERVED_MIN       257
51 #define RXKAD_TKT_TYPE_ADAPT_RESERVED_MAX       511
52
53 struct ktc_encryptionKey {
54     char data[8];
55 };
56
57 struct ktc_principal {
58     char name[MAXKTCNAMELEN];
59     char instance[MAXKTCNAMELEN];
60     char cell[MAXKTCREALMLEN];
61 #ifdef AFS_NT40_ENV
62     char smbname[MAXSMBNAMELEN];
63 #endif
64 };
65
66 #ifndef NEVERDATE
67 #define NEVERDATE 0xffffffff
68 #endif
69
70 /* this function round a length to the correct encryption block size */
71 #define round_up_to_ebs(v) (((v) + 7) & (~7))
72
73 typedef char rxkad_type;
74 #define rxkad_client 1          /* bits definitions */
75 #define rxkad_server 2
76
77 typedef char rxkad_level;
78 #define rxkad_clear 0           /* send packets in the clear */
79 #define rxkad_auth 1            /* send encrypted sequence numbers */
80 #define rxkad_crypt 2           /* encrypt packet data */
81
82 /* many stats are kept per type and per level.  These are encoded into an index
83  * from 0 to 5 by the StatIndex macro. */
84
85 #define rxkad_StatIndex(type,level) \
86     (((((type) == 1) || ((type) == 2)) && ((level) >= 0) && ((level) <= 2)) \
87      ? (((level)<<1)+(type)-1) : 0)
88 #define rxkad_LevelIndex(level) \
89     ((((level) >= 0) && ((level) <= 2)) ? (level) : 0)
90 #define rxkad_TypeIndex(type) \
91     ((((type) == 1) || ((type) == 2)) ? ((type)-1) : 0)
92
93
94 extern int rxkad_EpochWasSet;   /* TRUE => we called rx_SetEpoch */
95
96 #include "rxkad_prototypes.h"
97
98 #endif /* OPENAFS_RXKAD_RXKAD_H */