import cyrus-sasl-2.1.23
[cyrus-sasl.git] / mac / kerberos_includes / prot.h
1 /*
2  * $Source: /afs/andrew/system/cvs/src/sasl/mac/kerberos_includes/prot.h,v $
3  * $Author: rjs3 $
4  * $Header: /afs/andrew/system/cvs/src/sasl/mac/kerberos_includes/prot.h,v 1.2 2001/12/04 02:06:06 rjs3 Exp $
5  *
6  * Copyright 1985, 1986, 1987, 1988 by the Massachusetts Institute
7  * of Technology.
8  *
9  * For copying and distribution information, please see the file
10  * <mit-copyright.h>.
11  *
12  * Include file with authentication protocol information.
13  */
14 #ifndef _KERBEROS_PROT_H
15 #define _KERBEROS_PROT_H
16
17 #ifdef RUBBISH
18 #pragma ident   "@(#)prot.h     1.3     92/07/14 SMI"
19 #endif
20
21 //#include <kerberos/mit-copyright.h>
22 #ifdef RUBBISH
23 #include <kerberos/krb_conf.h>
24 #endif
25
26 #ifdef  __cplusplus
27 extern "C" {
28 #endif
29
30 #define         KRB_PORT                750     /* PC's don't have */
31                                                 /* /etc/services */
32 #define         KRB_PROT_VERSION        4
33 #define         MAX_PKT_LEN             1000
34 #define         MAX_TXT_LEN             1000
35 #define         TICKET_GRANTING_TICKET  "krbtgt"
36
37 /* Macro's to obtain various fields from a packet */
38
39 #define pkt_version(packet)  (unsigned int) *(packet->dat)
40 #define pkt_msg_type(packet) (unsigned int) *(packet->dat+1)
41 #define pkt_a_name(packet)   (packet->dat+2)
42 #define pkt_a_inst(packet)   \
43         (packet->dat+3+strlen((char *)pkt_a_name(packet)))
44 #define pkt_a_realm(packet)  \
45         (pkt_a_inst(packet)+1+strlen((char *)pkt_a_inst(packet)))
46
47 /* Macro to obtain realm from application request */
48 #define apreq_realm(auth)       (auth->dat + 3)
49
50 #define pkt_time_ws(packet) (char *) \
51         (packet->dat+5+strlen((char *)pkt_a_name(packet)) + \
52             strlen((char *)pkt_a_inst(packet)) + \
53             strlen((char *)pkt_a_realm(packet)))
54
55 #define pkt_no_req(packet) (unsigned short) \
56         *(packet->dat+9+strlen((char *)pkt_a_name(packet)) + \
57             strlen((char *)pkt_a_inst(packet)) + \
58             strlen((char *)pkt_a_realm(packet)))
59 #define pkt_x_date(packet) (char *) \
60         (packet->dat+10+strlen((char *)pkt_a_name(packet)) + \
61             strlen((char *)pkt_a_inst(packet)) + \
62             strlen((char *)pkt_a_realm(packet)))
63 #define pkt_err_code(packet) ((char *) \
64         (packet->dat+9+strlen((char *)pkt_a_name(packet)) + \
65             strlen((char *)pkt_a_inst(packet)) + \
66             strlen((char *)pkt_a_realm(packet))))
67 #define pkt_err_text(packet) \
68         (packet->dat+13+strlen((char *)pkt_a_name(packet)) + \
69             strlen((char *)pkt_a_inst(packet)) + \
70             strlen((char *)pkt_a_realm(packet)))
71
72 /* Routines to create and read packets may be found in prot.c */
73
74 #ifdef RUBBISH
75 KTEXT create_auth_reply();
76 KTEXT create_death_packet();
77 KTEXT pkt_cipher();
78 #endif
79
80 /* Message types , always leave lsb for byte order */
81
82 #define         AUTH_MSG_KDC_REQUEST                     1<<1
83 #define         AUTH_MSG_KDC_REPLY                       2<<1
84 #define         AUTH_MSG_APPL_REQUEST                    3<<1
85 #define         AUTH_MSG_APPL_REQUEST_MUTUAL             4<<1
86 #define         AUTH_MSG_ERR_REPLY                       5<<1
87 #define         AUTH_MSG_PRIVATE                         6<<1
88 #define         AUTH_MSG_SAFE                            7<<1
89 #define         AUTH_MSG_APPL_ERR                        8<<1
90 #define         AUTH_MSG_DIE                            63<<1
91
92 /* values for kerb error codes */
93
94 #define         KERB_ERR_OK                              0
95 #define         KERB_ERR_NAME_EXP                        1
96 #define         KERB_ERR_SERVICE_EXP                     2
97 #define         KERB_ERR_AUTH_EXP                        3
98 #define         KERB_ERR_PKT_VER                         4
99 #define         KERB_ERR_NAME_MAST_KEY_VER               5
100 #define         KERB_ERR_SERV_MAST_KEY_VER               6
101 #define         KERB_ERR_BYTE_ORDER                      7
102 #define         KERB_ERR_PRINCIPAL_UNKNOWN               8
103 #define         KERB_ERR_PRINCIPAL_NOT_UNIQUE            9
104 #define         KERB_ERR_NULL_KEY                       10
105
106 #ifdef  __cplusplus
107 }
108 #endif
109
110 #endif  /* _KERBEROS_PROT_H */