/* IBM_PROLOG_BEGIN_TAG                                                   */
/* This is an automatically generated prolog.                             */
/*                                                                        */
/* onc720 src/oncplus/usr/include/tirpc/rpc/auth_des.h 1.4                */
/*                                                                        */
/* Licensed Materials - Property of IBM                                   */
/*                                                                        */
/* COPYRIGHT International Business Machines Corp. 1996,1999              */
/* All Rights Reserved                                                    */
/*                                                                        */
/* US Government Users Restricted Rights - Use, duplication or            */
/* disclosure restricted by GSA ADP Schedule Contract with IBM Corp.      */
/*                                                                        */
/* IBM_PROLOG_END_TAG                                                     */
/* static char sccsid[] = "@(#)64  1.5  src/bos/usr/include/rpc/auth_des.h, libcrpc, bos420, 9613T 10/25/93 20:46:57"; */
/*
 *   COMPONENT_NAME: LIBCRPC
 *
 *   FUNCTIONS: 
 *
 *   ORIGINS: 24
 *
 * Copyright (c) 1990 by Sun Microsystems, Inc.
 *
 */

#ifndef	_RPC_AUTH_DES_H
#define	_RPC_AUTH_DES_H

/* #pragma ident	"@(#)auth_des.h	1.16	97/04/15 SMI" */

/*
 * auth_des.h, Protocol for DES style authentication for RPC
 *
 */

#ifdef	__cplusplus
extern "C" {
#endif


/*
 * There are two kinds of "names": fullnames and nicknames
 */
enum authdes_namekind {
	ADN_FULLNAME,
	ADN_NICKNAME
};

/*
 * A fullname contains the network name of the client,
 * a conversation key and the window
 */
struct authdes_fullname {
	char *name;	/* network name of client, up to MAXNETNAMELEN */
	des_block key;	/* conversation key */
#ifndef __64BIT__
	u_long window;	/* associated window */
#else
	u_int window;
#endif
};


/*
 * A credential
 */
struct authdes_cred {
	enum authdes_namekind adc_namekind;
	struct authdes_fullname adc_fullname;
#ifndef __64BIT__
	u_long adc_nickname;
#else
	u_int adc_nickname;
#endif
};

/*
 * A des authentication verifier
 */
struct authdes_verf {
	union {
		struct timeval adv_ctime;	/* clear time */
		des_block adv_xtime;		/* crypt time */
	} adv_time_u;
#ifndef __64BIT__
	u_long adv_int_u;
#else
	u_int adv_int_u;
#endif

};

/*
 * des authentication verifier: client variety
 *
 * adv_timestamp is the current time.
 * adv_winverf is the credential window + 1.
 * Both are encrypted using the conversation key.
 */
#define	adv_timestamp	adv_time_u.adv_ctime
#define	adv_xtimestamp	adv_time_u.adv_xtime
#define	adv_winverf	adv_int_u

/*
 * des authentication verifier: server variety
 *
 * adv_timeverf is the client's timestamp + client's window
 * adv_nickname is the server's nickname for the client.
 * adv_timeverf is encrypted using the conversation key.
 */
#define	adv_timeverf	adv_time_u.adv_ctime
#define	adv_xtimeverf	adv_time_u.adv_xtime
#define	adv_nickname	adv_int_u

/*
 * Map a des credential into a unix cred.
 *
 *  authdes_getucred(adc, uid, gid, grouplen, groups)
 *	struct authdes_cred *adc;
 *	uid_t *uid;
 *	gid_t *gid;
 *	short *grouplen;
 *	gid_t *groups;
 *
 */

extern int	authdes_getucred(const struct authdes_cred *,
				 uid_t *, gid_t *, short *, gid_t *);
extern int	getpublickey(char *, char *);
extern int	getsecretkey(const char *, char *, const char *);

#ifdef	__cplusplus
}
#endif

#endif	/* _RPC_AUTH_DES_H */
