Initial import from FreeBSD RELENG_4:
[dragonfly.git] / crypto / kerberosIV / lib / kafs / kafs.h
1 /*
2  * Copyright (c) 1995, 1996, 1997, 1998, 1999 Kungliga Tekniska Högskolan
3  * (Royal Institute of Technology, Stockholm, Sweden).
4  * All rights reserved.
5  * 
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions
8  * are met:
9  * 
10  * 1. Redistributions of source code must retain the above copyright
11  *    notice, this list of conditions and the following disclaimer.
12  * 
13  * 2. Redistributions in binary form must reproduce the above copyright
14  *    notice, this list of conditions and the following disclaimer in the
15  *    documentation and/or other materials provided with the distribution.
16  * 
17  * 3. Neither the name of the Institute nor the names of its contributors
18  *    may be used to endorse or promote products derived from this software
19  *    without specific prior written permission.
20  * 
21  * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
22  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24  * ARE DISCLAIMED.  IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
25  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31  * SUCH DAMAGE.
32  */
33
34 /* $Id: kafs.h,v 1.32 1999/12/02 16:58:40 joda Exp $ */
35 /* $FreeBSD: src/crypto/kerberosIV/lib/kafs/kafs.h,v 1.4 2000/01/09 08:53:34 markm Exp $ */
36
37 #ifndef __KAFS_H
38 #define __KAFS_H
39
40 /* XXX must include krb5.h or krb.h */
41
42 /* sys/ioctl.h must be included manually before kafs.h */
43
44 /*
45  */
46 #define AFSCALL_PIOCTL 20
47 #define AFSCALL_SETPAG 21
48
49 #ifndef _VICEIOCTL
50 #define _VICEIOCTL(id)  ((unsigned int ) _IOW('V', id, struct ViceIoctl))
51 #endif /* _VICEIOCTL */
52
53 #define VIOCSETAL               _VICEIOCTL(1)
54 #define VIOCGETAL               _VICEIOCTL(2)
55 #define VIOCSETTOK              _VICEIOCTL(3)
56 #define VIOCGETVOLSTAT          _VICEIOCTL(4)
57 #define VIOCSETVOLSTAT          _VICEIOCTL(5)
58 #define VIOCFLUSH               _VICEIOCTL(6)
59 #define VIOCGETTOK              _VICEIOCTL(8)
60 #define VIOCUNLOG               _VICEIOCTL(9)
61 #define VIOCCKSERV              _VICEIOCTL(10)
62 #define VIOCCKBACK              _VICEIOCTL(11)
63 #define VIOCCKCONN              _VICEIOCTL(12)
64 #define VIOCWHEREIS             _VICEIOCTL(14)
65 #define VIOCACCESS              _VICEIOCTL(20)
66 #define VIOCUNPAG               _VICEIOCTL(21)
67 #define VIOCGETFID              _VICEIOCTL(22)
68 #define VIOCSETCACHESIZE        _VICEIOCTL(24)
69 #define VIOCFLUSHCB             _VICEIOCTL(25)
70 #define VIOCNEWCELL             _VICEIOCTL(26)
71 #define VIOCGETCELL             _VICEIOCTL(27)
72 #define VIOC_AFS_DELETE_MT_PT   _VICEIOCTL(28)
73 #define VIOC_AFS_STAT_MT_PT     _VICEIOCTL(29)
74 #define VIOC_FILE_CELL_NAME     _VICEIOCTL(30)
75 #define VIOC_GET_WS_CELL        _VICEIOCTL(31)
76 #define VIOC_AFS_MARINER_HOST   _VICEIOCTL(32)
77 #define VIOC_GET_PRIMARY_CELL   _VICEIOCTL(33)
78 #define VIOC_VENUSLOG           _VICEIOCTL(34)
79 #define VIOC_GETCELLSTATUS      _VICEIOCTL(35)
80 #define VIOC_SETCELLSTATUS      _VICEIOCTL(36)
81 #define VIOC_FLUSHVOLUME        _VICEIOCTL(37)
82 #define VIOC_AFS_SYSNAME        _VICEIOCTL(38)
83 #define VIOC_EXPORTAFS          _VICEIOCTL(39)
84 #define VIOCGETCACHEPARAMS      _VICEIOCTL(40)
85 #define VIOC_GCPAGS             _VICEIOCTL(48) 
86
87 struct ViceIoctl {
88   caddr_t in, out;
89   short in_size;
90   short out_size;
91 };
92
93 struct ClearToken {
94   int32_t AuthHandle;
95   char HandShakeKey[8];
96   int32_t ViceId;
97   int32_t BeginTimestamp;
98   int32_t EndTimestamp;
99 };
100
101 #ifdef __STDC__
102 #ifndef __P
103 #define __P(x) x
104 #endif
105 #else
106 #ifndef __P
107 #define __P(x) ()
108 #endif
109 #endif
110
111 /* Use k_hasafs() to probe if the machine supports AFS syscalls.
112    The other functions will generate a SIGSYS if AFS is not supported */
113
114 int k_hasafs __P((void));
115
116 int krb_afslog __P((const char *cell, const char *realm));
117 int krb_afslog_uid __P((const char *cell, const char *realm, uid_t uid));
118 int krb_afslog_home __P((const char *cell, const char *realm,
119                          const char *homedir));
120 int krb_afslog_uid_home __P((const char *cell, const char *realm, uid_t uid,
121                              const char *homedir));
122
123 int krb_realm_of_cell __P((const char *cell, char **realm));
124
125 /* compat */
126 #define k_afsklog krb_afslog
127 #define k_afsklog_uid krb_afslog_uid
128
129 int k_pioctl __P((char *a_path,
130                   int o_opcode,
131                   struct ViceIoctl *a_paramsP,
132                   int a_followSymlinks));
133 int k_unlog __P((void));
134 int k_setpag __P((void));
135 int k_afs_cell_of_file __P((const char *path, char *cell, int len));
136
137
138
139 /* XXX */
140 #ifdef KFAILURE
141 #define KRB_H_INCLUDED
142 #endif
143
144 #ifdef KRB5_RECVAUTH_IGNORE_VERSION
145 #define KRB5_H_INCLUDED
146 #endif
147
148 #ifdef KRB_H_INCLUDED
149 int kafs_settoken __P((const char*, uid_t, CREDENTIALS*));
150 #endif
151
152 #ifdef KRB5_H_INCLUDED
153 krb5_error_code krb5_afslog_uid __P((krb5_context context,
154                                      krb5_ccache id,
155                                      const char *cell,
156                                      krb5_const_realm realm,
157                                      uid_t uid));
158 krb5_error_code krb5_afslog __P((krb5_context context,
159                                  krb5_ccache id, 
160                                  const char *cell,
161                                  krb5_const_realm realm));
162 krb5_error_code krb5_afslog_uid_home __P((krb5_context context,
163                                           krb5_ccache id,
164                                           const char *cell,
165                                           krb5_const_realm realm,
166                                           uid_t uid,
167                                           const char *homedir));
168
169 krb5_error_code krb5_afslog_home __P((krb5_context context,
170                                       krb5_ccache id,
171                                       const char *cell,
172                                       krb5_const_realm realm,
173                                       const char *homedir));
174
175 krb5_error_code krb5_realm_of_cell __P((const char *cell, char **realm));
176
177 #endif
178
179
180 #define _PATH_VICE              "/usr/vice/etc/"
181 #define _PATH_THISCELL          _PATH_VICE "ThisCell"
182 #define _PATH_CELLSERVDB        _PATH_VICE "CellServDB"
183 #define _PATH_THESECELLS        _PATH_VICE "TheseCells"
184
185 #define _PATH_ARLA_VICE         "/usr/arla/etc/"
186 #define _PATH_ARLA_THISCELL     _PATH_ARLA_VICE "ThisCell"
187 #define _PATH_ARLA_CELLSERVDB   _PATH_ARLA_VICE "CellServDB"
188 #define _PATH_ARLA_THESECELLS   _PATH_ARLA_VICE "TheseCells"
189
190 extern int _kafs_debug;
191
192 #endif /* __KAFS_H */