winnt-make-mountingother-than-as-afs-work-20021104
[openafs.git] / src / WINNT / afsd / krb_prot.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 /*
11  * Copyright 1985, 1986, 1987, 1988 by the Massachusetts Institute
12  * of Technology.
13  *
14  * For copying and distribution information, please see the file
15  * <mit-copyright.h>.
16  *
17  * Include file with authentication protocol information.
18  */
19
20 #ifndef PROT_DEFS
21 #define PROT_DEFS
22
23 #define         KRB_PORT                750     /* PC's don't have
24                                                  * /etc/services */
25 #define         KRB_PROT_VERSION        4
26 #define         MAX_PKT_LEN             1000
27 #define         MAX_TXT_LEN             1000
28 #define         TICKET_GRANTING_TICKET  "krbtgt"
29
30 /* Macro's to obtain various fields from a packet */
31
32 #define pkt_version(packet)  (unsigned int) *(packet->dat)
33 #define pkt_msg_type(packet) (unsigned int) *(packet->dat+1)
34 #define pkt_a_name(packet)   (packet->dat+2)
35 #define pkt_a_inst(packet)   \
36         (packet->dat+3+strlen((char *)pkt_a_name(packet)))
37 #define pkt_a_realm(packet)  \
38         (pkt_a_inst(packet)+1+strlen((char *)pkt_a_inst(packet)))
39
40 /* Macro to obtain realm from application request */
41 #define apreq_realm(auth)     (auth->dat + 3)
42
43 #define pkt_time_ws(packet) (char *) \
44         (packet->dat+5+strlen((char *)pkt_a_name(packet)) + \
45          strlen((char *)pkt_a_inst(packet)) + \
46          strlen((char *)pkt_a_realm(packet)))
47
48 #define pkt_no_req(packet) (unsigned short) \
49         *(packet->dat+9+strlen((char *)pkt_a_name(packet)) + \
50           strlen((char *)pkt_a_inst(packet)) + \
51           strlen((char *)pkt_a_realm(packet)))
52 #define pkt_x_date(packet) (char *) \
53         (packet->dat+10+strlen((char *)pkt_a_name(packet)) + \
54          strlen((char *)pkt_a_inst(packet)) + \
55          strlen((char *)pkt_a_realm(packet)))
56 #define pkt_err_code(packet) ( (char *) \
57         (packet->dat+9+strlen((char *)pkt_a_name(packet)) + \
58          strlen((char *)pkt_a_inst(packet)) + \
59          strlen((char *)pkt_a_realm(packet))))
60 #define pkt_err_text(packet) \
61         (packet->dat+13+strlen((char *)pkt_a_name(packet)) + \
62          strlen((char *)pkt_a_inst(packet)) + \
63          strlen((char *)pkt_a_realm(packet)))
64
65 /* Routines to create and read packets may be found in prot.c */
66
67 KTEXT create_auth_reply();
68 KTEXT create_death_packet();
69 KTEXT pkt_cipher();
70
71 /* Message types , always leave lsb for byte order */
72
73 #define         AUTH_MSG_KDC_REQUEST                     1<<1
74 #define         AUTH_MSG_KDC_REPLY                       2<<1
75 #define         AUTH_MSG_APPL_REQUEST                    3<<1
76 #define         AUTH_MSG_APPL_REQUEST_MUTUAL             4<<1
77 #define         AUTH_MSG_ERR_REPLY                       5<<1
78 #define         AUTH_MSG_PRIVATE                         6<<1
79 #define         AUTH_MSG_SAFE                            7<<1
80 #define         AUTH_MSG_APPL_ERR                        8<<1
81 #define         AUTH_MSG_DIE                            63<<1
82
83 /* values for kerb error codes */
84
85 #define         KERB_ERR_OK                              0
86 #define         KERB_ERR_NAME_EXP                        1
87 #define         KERB_ERR_SERVICE_EXP                     2
88 #define         KERB_ERR_AUTH_EXP                        3
89 #define         KERB_ERR_PKT_VER                         4
90 #define         KERB_ERR_NAME_MAST_KEY_VER               5
91 #define         KERB_ERR_SERV_MAST_KEY_VER               6
92 #define         KERB_ERR_BYTE_ORDER                      7
93 #define         KERB_ERR_PRINCIPAL_UNKNOWN               8
94 #define         KERB_ERR_PRINCIPAL_NOT_UNIQUE            9
95 #define         KERB_ERR_NULL_KEY                       10
96
97 #endif /* PROT_DEFS */