windows-updates-20041016
[openafs.git] / src / WINNT / afsd / cm_user.h
1 /*
2  * Copyright 2000, International Business Machines Corporation and others.
3  * All Rights Reserved.
4  * 
5  * This software has been released under the terms of the IBM Public
6  * License.  For details, see the LICENSE file in the top-level source
7  * directory or online at http://www.openafs.org/dl/license10.html
8  */
9
10 #ifndef __CM_USER_H_ENV__
11 #define __CM_USER_H_ENV__ 1
12
13 #include <osi.h>
14 #include <rx/rxkad.h>
15
16 /* user structure
17  * no free references outside of cm_allUsersp
18  * there are held references from cm_conn_t.
19  * 
20  * All the fields in this structure are locked by the
21  * corresponding userp's userp->mx mutex.
22  */
23 typedef struct cm_ucell {
24         struct cm_ucell *nextp;         /* next cell in the list */
25         struct cm_cell *cellp;          /* the cell this applies to */
26         char *ticketp;                  /* locked by mx */
27         int ticketLen;                  /* by mx */
28         struct ktc_encryptionKey sessionKey;    /* by mx */
29         long kvno;                      /* key version in ticket */
30         long expirationTime;            /* when tix expire */
31         int gen;                        /* generation number */
32         int iterator;                   /* for use as ListTokens cookie */
33         long flags;                     /* flags */
34         char userName[MAXKTCNAMELEN];   /* user name */
35 } cm_ucell_t;
36
37 #define CM_UCELLFLAG_HASTIX     1       /* has Kerberos tickets */
38 #define CM_UCELLFLAG_RXKAD      2       /* an rxkad connection */
39 #define CM_UCELLFLAG_BADTIX     4       /* tickets are bad or expired */
40
41 typedef struct cm_user {
42         unsigned long refCount;                 /* ref count */
43         cm_ucell_t *cellInfop;          /* list of cell info */
44         osi_mutex_t mx;                 /* mutex */
45         int vcRefs;                     /* count of references from virtual circuits */
46         long flags;
47 } cm_user_t;
48
49 #define CM_USERFLAG_DELETE      1       /* delete on last reference */
50 #define CM_USERFLAG_WASLOGON    2       /* was logon DLL user */
51
52 extern void cm_InitUser(void);
53
54 extern cm_user_t *cm_NewUser(void);
55
56 extern cm_ucell_t *cm_GetUCell(cm_user_t *userp, struct cm_cell *cellp);
57
58 extern cm_ucell_t *cm_FindUCell(cm_user_t *userp, int iterator);
59
60 extern void cm_HoldUser(cm_user_t *up);
61
62 extern void cm_ReleaseUser(cm_user_t *up);
63
64 extern void cm_ReleaseUserVCRef(cm_user_t *up);
65
66 extern void cm_CheckTokenCache(long now);
67
68 extern cm_user_t *cm_rootUserp;
69
70 #endif /*  __CM_USER_H_ENV__ */