1*7c478bd9Sstevel@tonic-gate /* 2*7c478bd9Sstevel@tonic-gate * Copyright 2004 Sun Microsystems, Inc. All rights reserved. 3*7c478bd9Sstevel@tonic-gate * Use is subject to license terms. 4*7c478bd9Sstevel@tonic-gate */ 5*7c478bd9Sstevel@tonic-gate 6*7c478bd9Sstevel@tonic-gate #ifndef _KRB5_RC_COM_H 7*7c478bd9Sstevel@tonic-gate #define _KRB5_RC_COM_H 8*7c478bd9Sstevel@tonic-gate 9*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus 10*7c478bd9Sstevel@tonic-gate extern "C" { 11*7c478bd9Sstevel@tonic-gate #endif 12*7c478bd9Sstevel@tonic-gate 13*7c478bd9Sstevel@tonic-gate /* 14*7c478bd9Sstevel@tonic-gate * mech_krb5/krb5/rcache/rc_common.h 15*7c478bd9Sstevel@tonic-gate * 16*7c478bd9Sstevel@tonic-gate * This file of the Kerberos V5 software is derived from public-domain code 17*7c478bd9Sstevel@tonic-gate * contributed by Daniel J. Bernstein, <brnstnd@acf10.nyu.edu>. 18*7c478bd9Sstevel@tonic-gate */ 19*7c478bd9Sstevel@tonic-gate 20*7c478bd9Sstevel@tonic-gate #include "rc_base.h" 21*7c478bd9Sstevel@tonic-gate #include "rc_io.h" 22*7c478bd9Sstevel@tonic-gate #include <k5-int.h> 23*7c478bd9Sstevel@tonic-gate 24*7c478bd9Sstevel@tonic-gate /* 25*7c478bd9Sstevel@tonic-gate * Declarations shared for the file and memory replay cache implementation. 26*7c478bd9Sstevel@tonic-gate */ 27*7c478bd9Sstevel@tonic-gate 28*7c478bd9Sstevel@tonic-gate #ifndef HASHSIZE 29*7c478bd9Sstevel@tonic-gate #define HASHSIZE 997 /* a convenient prime */ 30*7c478bd9Sstevel@tonic-gate #endif 31*7c478bd9Sstevel@tonic-gate 32*7c478bd9Sstevel@tonic-gate #define CMP_MALLOC -3 33*7c478bd9Sstevel@tonic-gate #define CMP_EXPIRED -2 34*7c478bd9Sstevel@tonic-gate #define CMP_REPLAY -1 35*7c478bd9Sstevel@tonic-gate #define CMP_HOHUM 0 36*7c478bd9Sstevel@tonic-gate 37*7c478bd9Sstevel@tonic-gate /* 38*7c478bd9Sstevel@tonic-gate * Solaris: made cmp a macro and removed unused t arg to help perf 39*7c478bd9Sstevel@tonic-gate */ 40*7c478bd9Sstevel@tonic-gate #define cmp(old, new) \ 41*7c478bd9Sstevel@tonic-gate (((old)->cusec == (new)->cusec) && \ 42*7c478bd9Sstevel@tonic-gate ((old)->ctime == (new)->ctime) && \ 43*7c478bd9Sstevel@tonic-gate (strcmp((old)->client, (new)->client) == 0) && \ 44*7c478bd9Sstevel@tonic-gate (strcmp((old)->server, (new)->server) == 0) ? CMP_REPLAY : CMP_HOHUM) 45*7c478bd9Sstevel@tonic-gate 46*7c478bd9Sstevel@tonic-gate /* 47*7c478bd9Sstevel@tonic-gate * Solaris: made alive a macro and time a arg instead of calling 48*7c478bd9Sstevel@tonic-gate * krb5_timeofday() for better perf. 49*7c478bd9Sstevel@tonic-gate */ 50*7c478bd9Sstevel@tonic-gate #define alive(context, new, t, time) \ 51*7c478bd9Sstevel@tonic-gate (((new)->ctime + (t)) < (time) ? CMP_EXPIRED : CMP_HOHUM) 52*7c478bd9Sstevel@tonic-gate 53*7c478bd9Sstevel@tonic-gate struct authlist { 54*7c478bd9Sstevel@tonic-gate krb5_donot_replay rep; 55*7c478bd9Sstevel@tonic-gate struct authlist *na; 56*7c478bd9Sstevel@tonic-gate struct authlist *nh; 57*7c478bd9Sstevel@tonic-gate }; 58*7c478bd9Sstevel@tonic-gate 59*7c478bd9Sstevel@tonic-gate int hash(krb5_donot_replay *rep, int hsize); 60*7c478bd9Sstevel@tonic-gate 61*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus 62*7c478bd9Sstevel@tonic-gate } 63*7c478bd9Sstevel@tonic-gate #endif 64*7c478bd9Sstevel@tonic-gate 65*7c478bd9Sstevel@tonic-gate #endif /* !_KRB5_RC_COM_H */ 66