Initial import from FreeBSD RELENG_4:
[games.git] / crypto / kerberosIV / lib / krb / krb-protos.h
1 /*
2  * Copyright (c) 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: krb-protos.h,v 1.24.2.1 2000/06/23 03:32:04 assar Exp $ */
35 /* $FreeBSD: src/crypto/kerberosIV/lib/krb/krb-protos.h,v 1.1.1.2.2.2 2003/02/13 21:34:36 nectar Exp $ */
36
37 #ifndef __krb_protos_h__
38 #define __krb_protos_h__
39
40 #if defined (__STDC__) || defined (_MSC_VER)
41 #include <stdarg.h>
42 #ifndef __P
43 #define __P(x) x
44 #endif
45 #else
46 #ifndef __P
47 #define __P(x) ()
48 #endif
49 #endif
50
51 #ifdef __STDC__
52 struct in_addr;
53 struct sockaddr_in;
54 struct timeval;
55 #endif
56
57 #ifndef KRB_LIB_FUNCTION
58 #if defined(__BORLANDC__)
59 #define KRB_LIB_FUNCTION /* not-ready-definition-yet */
60 #elif defined(_MSC_VER)
61 #define KRB_LIB_FUNCTION /* not-ready-definition-yet2 */
62 #else
63 #define KRB_LIB_FUNCTION
64 #endif
65 #endif
66
67 void KRB_LIB_FUNCTION
68 afs_string_to_key __P((
69         const char *str,
70         const char *cell,
71         des_cblock *key));
72
73 int KRB_LIB_FUNCTION
74 create_ciph __P((
75         KTEXT c,
76         unsigned char *session,
77         char *service,
78         char *instance,
79         char *realm,
80         u_int32_t life,
81         int kvno,
82         KTEXT tkt,
83         u_int32_t kdc_time,
84         des_cblock *key));
85
86 int KRB_LIB_FUNCTION
87 cr_err_reply __P((
88         KTEXT pkt,
89         char *pname,
90         char *pinst,
91         char *prealm,
92         u_int32_t time_ws,
93         u_int32_t e,
94         char *e_string));
95
96 int KRB_LIB_FUNCTION
97 decomp_ticket __P((
98         KTEXT tkt,
99         unsigned char *flags,
100         char *pname,
101         char *pinstance,
102         char *prealm,
103         u_int32_t *paddress,
104         unsigned char *session,
105         int *life,
106         u_int32_t *time_sec,
107         char *sname,
108         char *sinstance,
109         des_cblock *key,
110         des_key_schedule schedule));
111
112 int KRB_LIB_FUNCTION
113 dest_tkt __P((void));
114
115 int KRB_LIB_FUNCTION
116 get_ad_tkt __P((
117         char *service,
118         char *sinstance,
119         char *realm,
120         int lifetime));
121
122 int KRB_LIB_FUNCTION
123 getst __P((
124         int fd,
125         char *s,
126         int n));
127
128 int KRB_LIB_FUNCTION
129 in_tkt __P((
130         char *pname,
131         char *pinst));
132
133 int KRB_LIB_FUNCTION
134 k_get_all_addrs __P((struct in_addr **l));
135
136 int KRB_LIB_FUNCTION
137 k_gethostname __P((
138         char *name,
139         int namelen));
140
141 int KRB_LIB_FUNCTION
142 k_getportbyname __P((
143         const char *service,
144         const char *proto,
145         int default_port));
146
147 int KRB_LIB_FUNCTION
148 k_getsockinst __P((
149         int fd,
150         char *inst,
151         size_t inst_size));
152
153 int KRB_LIB_FUNCTION
154 k_isinst __P((char *s));
155
156 int KRB_LIB_FUNCTION
157 k_isname __P((char *s));
158
159 int KRB_LIB_FUNCTION
160 k_isrealm __P((char *s));
161
162 struct tm * KRB_LIB_FUNCTION
163 k_localtime __P((u_int32_t *tp));
164
165 int KRB_LIB_FUNCTION
166 kname_parse __P((
167         char *np,
168         char *ip,
169         char *rp,
170         char *fullname));
171
172 int KRB_LIB_FUNCTION
173 krb_atime_to_life __P((char *atime));
174
175 int KRB_LIB_FUNCTION
176 krb_check_auth __P((
177         KTEXT packet,
178         u_int32_t checksum,
179         MSG_DAT *msg_data,
180         des_cblock *session,
181         des_key_schedule schedule,
182         struct sockaddr_in *laddr,
183         struct sockaddr_in *faddr));
184
185 int KRB_LIB_FUNCTION
186 krb_check_tm __P((struct tm tm));
187
188 KTEXT KRB_LIB_FUNCTION
189 krb_create_death_packet __P((char *a_name));
190
191 int KRB_LIB_FUNCTION
192 krb_create_ticket __P((
193         KTEXT tkt,
194         unsigned char flags,
195         char *pname,
196         char *pinstance,
197         char *prealm,
198         int32_t paddress,
199         void *session,
200         int16_t life,
201         int32_t time_sec,
202         char *sname,
203         char *sinstance,
204         des_cblock *key));
205
206 int KRB_LIB_FUNCTION
207 krb_decode_as_rep __P((
208         const char *user,
209         char *instance,         /* INOUT parameter */
210         const char *realm,
211         const char *service,
212         const char *sinstance,
213         key_proc_t key_proc,
214         decrypt_proc_t decrypt_proc,
215         const void *arg,
216         KTEXT as_rep,
217         CREDENTIALS *cred));
218
219 int KRB_LIB_FUNCTION
220 krb_disable_debug __P((void));
221
222 int KRB_LIB_FUNCTION
223 krb_enable_debug __P((void));
224
225 int KRB_LIB_FUNCTION
226 krb_equiv __P((
227         u_int32_t a,
228         u_int32_t b));
229
230 int KRB_LIB_FUNCTION
231 krb_get_address __P((
232         void *from,
233         u_int32_t *to));
234
235 int KRB_LIB_FUNCTION
236 krb_get_admhst __P((
237         char *host,
238         char *realm,
239         int nth));
240
241 int KRB_LIB_FUNCTION
242 krb_get_config_bool __P((const char *variable));
243
244 const char * KRB_LIB_FUNCTION
245 krb_get_config_string __P((const char *variable));
246
247 int KRB_LIB_FUNCTION
248 krb_get_cred __P((
249         char *service,
250         char *instance,
251         char *realm,
252         CREDENTIALS *c));
253
254 int KRB_LIB_FUNCTION
255 krb_get_default_principal __P((
256         char *name,
257         char *instance,
258         char *realm));
259
260 char * KRB_LIB_FUNCTION
261 krb_get_default_realm __P((void));
262
263 const char * KRB_LIB_FUNCTION
264 krb_get_default_tkt_root __P((void));
265
266 const char * KRB_LIB_FUNCTION
267 krb_get_default_keyfile __P((void));
268
269 const char * KRB_LIB_FUNCTION
270 krb_get_err_text __P((int code));
271
272 struct krb_host* KRB_LIB_FUNCTION
273 krb_get_host __P((
274         int nth,
275         const char *realm,
276         int admin));
277
278 int KRB_LIB_FUNCTION
279 krb_get_in_tkt __P((
280         char *user,
281         char *instance,
282         char *realm,
283         char *service,
284         char *sinstance,
285         int life,
286         key_proc_t key_proc,
287         decrypt_proc_t decrypt_proc,
288         void *arg));
289
290 int KRB_LIB_FUNCTION
291 krb_get_int __P((
292         void *f,
293         u_int32_t *to,
294         int size,
295         int lsb));
296
297 int KRB_LIB_FUNCTION
298 krb_get_kdc_time_diff __P((void));
299
300 int KRB_LIB_FUNCTION
301 krb_get_krbconf __P((
302         int num,
303         char *buf,
304         size_t len));
305
306 int KRB_LIB_FUNCTION
307 krb_get_krbextra __P((
308         int num,
309         char *buf,
310         size_t len));
311
312 int KRB_LIB_FUNCTION
313 krb_get_krbhst __P((
314         char *host,
315         char *realm,
316         int nth));
317
318 int KRB_LIB_FUNCTION
319 krb_get_krbrealms __P((
320         int num,
321         char *buf,
322         size_t len));
323
324 int KRB_LIB_FUNCTION
325 krb_get_lrealm __P((
326         char *r,
327         int n));
328
329 int KRB_LIB_FUNCTION
330 krb_get_nir __P((
331         void *from,
332         char *name, size_t name_len,
333         char *instance, size_t instance_len,
334         char *realm, size_t realm_len));
335
336 char * KRB_LIB_FUNCTION
337 krb_get_phost __P((const char *alias));
338
339 int KRB_LIB_FUNCTION
340 krb_get_pw_in_tkt __P((
341         const char *user,
342         const char *instance,
343         const char *realm,
344         const char *service,
345         const char *sinstance,
346         int life,
347         const char *password));
348
349 int KRB_LIB_FUNCTION
350 krb_get_pw_in_tkt2 __P((
351         const char *user,
352         const char *instance,
353         const char *realm,
354         const char *service,
355         const char *sinstance,
356         int life,
357         const char *password,
358         des_cblock *key));
359
360 int KRB_LIB_FUNCTION
361 krb_get_string __P((
362         void *from,
363         char *to,
364         size_t to_size));
365
366 int KRB_LIB_FUNCTION
367 krb_get_svc_in_tkt __P((
368         char *user,
369         char *instance,
370         char *realm,
371         char *service,
372         char *sinstance,
373         int life,
374         char *srvtab));
375
376 int KRB_LIB_FUNCTION
377 krb_get_tf_fullname __P((
378         char *ticket_file,
379         char *name,
380         char *instance,
381         char *realm));
382
383 int KRB_LIB_FUNCTION
384 krb_get_tf_realm __P((
385         char *ticket_file,
386         char *realm));
387
388 void KRB_LIB_FUNCTION
389 krb_kdctimeofday __P((struct timeval *tv));
390
391 int KRB_LIB_FUNCTION
392 krb_kntoln __P((
393         AUTH_DAT *ad,
394         char *lname));
395
396 int KRB_LIB_FUNCTION
397 krb_kuserok __P((
398         char *name,
399         char *instance,
400         char *realm,
401         char *luser));
402
403 char * KRB_LIB_FUNCTION
404 krb_life_to_atime __P((int life));
405
406 u_int32_t KRB_LIB_FUNCTION
407 krb_life_to_time __P((
408         u_int32_t start,
409         int life_));
410
411 int KRB_LIB_FUNCTION
412 krb_lsb_antinet_ulong_cmp __P((
413         u_int32_t x,
414         u_int32_t y));
415
416 int KRB_LIB_FUNCTION
417 krb_lsb_antinet_ushort_cmp __P((
418         u_int16_t x,
419         u_int16_t y));
420
421 int KRB_LIB_FUNCTION
422 krb_mk_as_req __P((
423         const char *user,
424         const char *instance,
425         const char *realm,
426         const char *service,
427         const char *sinstance,
428         int life,
429         KTEXT cip));
430
431 int KRB_LIB_FUNCTION
432 krb_mk_auth __P((
433         int32_t options,
434         KTEXT ticket,
435         char *service,
436         char *instance,
437         char *realm,
438         u_int32_t checksum,
439         char *version,
440         KTEXT buf));
441
442 int32_t KRB_LIB_FUNCTION
443 krb_mk_err __P((
444         u_char *p,
445         int32_t e,
446         char *e_string));
447
448 int32_t KRB_LIB_FUNCTION
449 krb_mk_priv __P((
450         void *in,
451         void *out,
452         u_int32_t length,
453         des_key_schedule schedule,
454         des_cblock *key,
455         struct sockaddr_in *sender,
456         struct sockaddr_in *receiver));
457
458 int KRB_LIB_FUNCTION
459 krb_mk_req __P((
460         KTEXT authent,
461         char *service,
462         char *instance,
463         char *realm,
464         int32_t checksum));
465
466 int32_t KRB_LIB_FUNCTION
467 krb_mk_safe __P((
468         void *in,
469         void *out,
470         u_int32_t length,
471         des_cblock *key,
472         struct sockaddr_in *sender,
473         struct sockaddr_in *receiver));
474
475 int KRB_LIB_FUNCTION
476 krb_net_read __P((
477         int fd,
478         void *v,
479         size_t len));
480
481 int KRB_LIB_FUNCTION
482 krb_net_write __P((
483         int fd,
484         const void *v,
485         size_t len));
486
487 int KRB_LIB_FUNCTION
488 krb_parse_name __P((
489         const char *fullname,
490         krb_principal *principal));
491
492 int KRB_LIB_FUNCTION
493 krb_put_address __P((
494         u_int32_t addr,
495         void *to,
496         size_t rem));
497
498 int KRB_LIB_FUNCTION
499 krb_put_int __P((
500         u_int32_t from,
501         void *to,
502         size_t rem,
503         int size));
504
505 int KRB_LIB_FUNCTION
506 krb_put_nir __P((
507         const char *name,
508         const char *instance,
509         const char *realm,
510         void *to,
511         size_t rem));
512
513 int KRB_LIB_FUNCTION
514 krb_put_string __P((
515         const char *from,
516         void *to,
517         size_t rem));
518
519 int KRB_LIB_FUNCTION
520 krb_rd_err __P((
521         u_char *in,
522         u_int32_t in_length,
523         int32_t *code,
524         MSG_DAT *m_data));
525
526 int32_t KRB_LIB_FUNCTION
527 krb_rd_priv __P((
528         void *in,
529         u_int32_t in_length,
530         des_key_schedule schedule,
531         des_cblock *key,
532         struct sockaddr_in *sender,
533         struct sockaddr_in *receiver,
534         MSG_DAT *m_data));
535
536 int KRB_LIB_FUNCTION
537 krb_rd_req __P((
538         KTEXT authent,
539         char *service,
540         char *instance,
541         int32_t from_addr,
542         AUTH_DAT *ad,
543         char *fn));
544
545 int32_t KRB_LIB_FUNCTION
546 krb_rd_safe __P((
547         void *in,
548         u_int32_t in_length,
549         des_cblock *key,
550         struct sockaddr_in *sender,
551         struct sockaddr_in *receiver,
552         MSG_DAT *m_data));
553
554 int KRB_LIB_FUNCTION
555 krb_realm_parse __P((
556         char *realm,
557         int length));
558
559 char * KRB_LIB_FUNCTION
560 krb_realmofhost __P((const char *host));
561
562 int KRB_LIB_FUNCTION
563 krb_recvauth __P((
564         int32_t options,
565         int fd,
566         KTEXT ticket,
567         char *service,
568         char *instance,
569         struct sockaddr_in *faddr,
570         struct sockaddr_in *laddr,
571         AUTH_DAT *kdata,
572         char *filename,
573         des_key_schedule schedule,
574         char *version));
575
576 int KRB_LIB_FUNCTION
577 krb_sendauth __P((
578         int32_t options,
579         int fd,
580         KTEXT ticket,
581         char *service,
582         char *instance,
583         char *realm,
584         u_int32_t checksum,
585         MSG_DAT *msg_data,
586         CREDENTIALS *cred,
587         des_key_schedule schedule,
588         struct sockaddr_in *laddr,
589         struct sockaddr_in *faddr,
590         char *version));
591
592 void KRB_LIB_FUNCTION
593 krb_set_kdc_time_diff __P((int diff));
594
595 int KRB_LIB_FUNCTION
596 krb_set_key __P((
597         void *key,
598         int cvt));
599
600 int KRB_LIB_FUNCTION
601 krb_set_lifetime __P((int newval));
602
603 void KRB_LIB_FUNCTION
604 krb_set_tkt_string __P((const char *val));
605
606 const char * KRB_LIB_FUNCTION
607 krb_stime __P((time_t *t));
608
609 int KRB_LIB_FUNCTION
610 krb_time_to_life __P((
611         u_int32_t start,
612         u_int32_t end));
613
614 char * KRB_LIB_FUNCTION
615 krb_unparse_name __P((krb_principal *pr));
616
617 char * KRB_LIB_FUNCTION
618 krb_unparse_name_long __P((
619         char *name,
620         char *instance,
621         char *realm));
622
623 char * KRB_LIB_FUNCTION
624 krb_unparse_name_long_r __P((
625         char *name,
626         char *instance,
627         char *realm,
628         char *fullname));
629
630 char * KRB_LIB_FUNCTION
631 krb_unparse_name_r __P((
632         krb_principal *pr,
633         char *fullname));
634
635 int KRB_LIB_FUNCTION
636 krb_use_admin_server __P((int flag));
637
638 int KRB_LIB_FUNCTION
639 krb_verify_user __P((
640         char *name,
641         char *instance,
642         char *realm,
643         char *password,
644         int secure,
645         char *linstance));
646
647 int KRB_LIB_FUNCTION
648 krb_verify_user_srvtab __P((
649         char *name,
650         char *instance,
651         char *realm,
652         char *password,
653         int secure,
654         char *linstance,
655         char *srvtab));
656
657 int KRB_LIB_FUNCTION
658 kuserok __P((
659         AUTH_DAT *auth,
660         char *luser));
661
662 u_int32_t KRB_LIB_FUNCTION
663 lsb_time __P((
664         time_t t,
665         struct sockaddr_in *src,
666         struct sockaddr_in *dst));
667
668 const char * KRB_LIB_FUNCTION
669 month_sname __P((int n));
670
671 int KRB_LIB_FUNCTION
672 passwd_to_5key __P((
673         const char *user,
674         const char *instance,
675         const char *realm,
676         const void *passwd,
677         des_cblock *key));
678
679 int KRB_LIB_FUNCTION
680 passwd_to_afskey __P((
681         const char *user,
682         const char *instance,
683         const char *realm,
684         const void *passwd,
685         des_cblock *key));
686
687 int KRB_LIB_FUNCTION
688 passwd_to_key __P((
689         const char *user,
690         const char *instance,
691         const char *realm,
692         const void *passwd,
693         des_cblock *key));
694
695 int KRB_LIB_FUNCTION
696 read_service_key __P((
697         const char *service,
698         char *instance,
699         const char *realm,
700         int kvno,
701         const char *file,
702         void *key));
703
704 int KRB_LIB_FUNCTION
705 save_credentials __P((
706         char *service,
707         char *instance,
708         char *realm,
709         unsigned char *session,
710         int lifetime,
711         int kvno,
712         KTEXT ticket,
713         int32_t issue_date));
714
715 int KRB_LIB_FUNCTION
716 send_to_kdc __P((
717         KTEXT pkt,
718         KTEXT rpkt,
719         const char *realm));
720
721 int KRB_LIB_FUNCTION
722 srvtab_to_key __P((
723         const char *user,
724         char *instance,         /* INOUT parameter */
725         const char *realm,
726         const void *srvtab,
727         des_cblock *key));
728
729 void KRB_LIB_FUNCTION
730 tf_close __P((void));
731
732 int KRB_LIB_FUNCTION
733 tf_create __P((char *tf_name));
734
735 int KRB_LIB_FUNCTION
736 tf_get_cred __P((CREDENTIALS *c));
737
738 int KRB_LIB_FUNCTION
739 tf_get_cred_addr __P((char *realm, size_t realm_sz, struct in_addr *addr));
740
741 int KRB_LIB_FUNCTION
742 tf_get_pinst __P((char *inst));
743
744 int KRB_LIB_FUNCTION
745 tf_get_pname __P((char *p));
746
747 int KRB_LIB_FUNCTION
748 tf_init __P((
749         char *tf_name,
750         int rw));
751
752 int KRB_LIB_FUNCTION
753 tf_put_pinst __P((const char *inst));
754
755 int KRB_LIB_FUNCTION
756 tf_put_pname __P((const char *p));
757
758 int KRB_LIB_FUNCTION
759 tf_save_cred __P((
760         char *service,
761         char *instance,
762         char *realm,
763         unsigned char *session,
764         int lifetime,
765         int kvno,
766         KTEXT ticket,
767         u_int32_t issue_date));
768
769 int KRB_LIB_FUNCTION
770 tf_setup __P((
771         CREDENTIALS *cred,
772         const char *pname,
773         const char *pinst));
774
775 int KRB_LIB_FUNCTION
776 tf_get_addr __P((
777         const char *realm,
778         struct in_addr *addr));
779
780 int KRB_LIB_FUNCTION
781 tf_store_addr __P((const char *realm, struct in_addr *addr));
782
783 char * KRB_LIB_FUNCTION
784 tkt_string __P((void));
785
786 int KRB_LIB_FUNCTION
787 krb_add_our_ip_for_realm __P((const char *user, const char *instance,
788                               const char *realm, const char *password));
789
790 #endif /* __krb_protos_h__ */