2 * Copyright 2000, International Business Machines Corporation and others.
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
10 #ifndef _APACHE_AFS_CACHE_H_INCLUDED_
11 #define _APACHE_AFS_CACHE_H_INCLUDED_
17 #include <sys/types.h>
22 #define MAX(A,B) ((A)>(B)?(A):(B))
25 #define MIN(A,B) ((A)<(B)?(A):(B))
29 * Macros to manipulate doubly linked lists
32 #define DLL_INIT_LIST(_HEAD, _TAIL) \
33 { _HEAD = NULL ; _TAIL = NULL; }
35 #define DLL_INSERT_TAIL(_ELEM, _HEAD, _TAIL, _NEXT, _PREV) \
37 if (_HEAD == NULL) { \
38 _ELEM->_NEXT = NULL; \
39 _ELEM->_PREV = NULL; \
43 _ELEM->_NEXT = NULL; \
44 _ELEM->_PREV = _TAIL; \
45 _TAIL->_NEXT = _ELEM; \
50 #define DLL_DELETE(_ELEM, _HEAD, _TAIL, _NEXT, _PREV) \
52 if (_ELEM->_NEXT == NULL) { \
53 _TAIL = _ELEM->_PREV; \
55 _ELEM->_NEXT->_PREV = _ELEM->_PREV; \
57 if (_ELEM->_PREV == NULL) { \
58 _HEAD = _ELEM->_NEXT; \
60 _ELEM->_PREV->_NEXT = _ELEM->_NEXT; \
62 _ELEM->_NEXT = NULL; \
63 _ELEM->_PREV = NULL; \
67 #define WEBLOG_BUFFER_SIZE 4096 /* Send/Receive buffer size */
68 #define WEBLOG_MAX_PATH 1024 /* Maximum path length */
69 #define WEBLOG_USERNAME_MAX 64 /* Maximum username length */
70 #define WEBLOG_CELLNAME_MAX 64 /* Maximum password length */
71 #define WEBLOG_PASSWORD_MAX 64
72 #define WEBLOG_LOGIN_HASH_SIZE 1024 /* MUST be power of two */
73 #define TEN_MINUTES 600 /* 10 minutes = 600 seconds */
75 #define MAXBUFF 1024 /* CHECK THIS - size of token */
77 * Structure user to store entries in AFS login cache
80 afs_uint32 expiration;
83 char username[WEBLOG_USERNAME_MAX];
84 char cellname[WEBLOG_CELLNAME_MAX];
85 char cksum[SHA_HASH_BYTES];
86 struct weblog_login *next;
87 struct weblog_login *prev;
92 extern int weblog_login_hash(char *name, char *cell);
93 extern void weblog_login_checksum(char *user, char *cell, char *passwd,
95 extern int weblog_login_lookup(char *user, char *cell, char *cksum,
97 extern int weblog_login_store(char *user, char *cell, char *cksum,
98 char *token, int tokenLen,
99 afs_uint32 expiration);
100 extern int getTokenLen(char *token);
102 #endif /* _APACHE_AFS_CACHE_H_INCLUDED_ */