/* charon.h -- This file contains prototypes and definitions for 
 * external programs for charon, the serial-line kerberos library
 * and extentions.
 *
 * Created by:	Derek Atkins <warlord@MIT.EDU>
 *
 * $Source: /afs/net.mit.edu/user/warlord/Thesis/src/include/RCS/charon.h,v $
 * $Author: warlord $
 *
 */

#include <warlord-copyright.h>

#ifndef _CHARON_H
#define _CHARON_H

#include <stdio.h>
#include <charon_err.h>
#include <des.h>

/* Sets the input file to this file */
extern void crn_set_input_file(FILE *file);

/* Sets the output file to this file */
extern void crn_set_output_file(FILE *file);

/* Sets the output character function to this function.  It expects
 * the form: int fcn(char c)
 */
extern void crn_set_putc_fcn(int (*fcn)());

/* Sets the input character function, of the form:
 * int fcn()
 */
extern void crn_set_getc_fcn(int (*fcn)());

/* Set an output-line function of the form:
 * int fcn(char *line, int len)
 */
extern void crn_set_puts_fcn(int (*fcn)());

/* Sets the output-line function, of the form:
 * int fcn(char *line, FILE *stream)
 */
extern void crn_set_fputs_fcn(int (*fcn)());

/* Sets the input-line funtion, of the form:
 * int fcn(char *data, int space, FILE *stream)
 */
extern void crn_set_fgets_fcn(int (*fcn)());

/* Server call to get tickets.  Returns CRN_OK on success, or
 * some error code.
 */
extern int crn_srv_get_tickets(char *principal, char *instance,
			       char *realm, char *hostrealm, int lifetime, 
			       char *ticketfile, int version, 
			       char *enc_ses, des_cblock *key);

/* Client call to get tickets.  Returns CRN_OK on success, or
 * some error code.
 */
extern int crn_cli_get_tickets(int version, int (*key_proc)(),
			       char *enc_ses, des_cblock *key);

/* Return an error message from an error number */
extern char *crn_err_msg(int error);

/* Set an error file for debugging information to go to. */
extern void crn_rpc_set_debug_file(char *file);

/* Turn echo of on the file descriptor */
extern void *crn_kill_echo(int fd);

/* Revert echoing back to its predescesor state */
extern void crn_revert_echo(void *state);

/* These definitions are for encryption using Charon.  They define how
 * the session is going to be encrypted.  There are four possibilities
 * for this value.
 */
#define CRN_ENC_NONE	0	/* No encryption */
#define CRN_ENC_CLI	1	/* Encrypt from the Client only */
#define CRN_ENC_SRV	2	/* Encrypt from the Server only */
#define CRN_ENC_BOTH	3	/* Encrypt both directions */

#endif /* _CHARON_H */
