00001
00002
00003
00004
00005
00006
00007
00008 #ifndef CHIRP_GROUP_H
00009 #define CHIRP_GROUP_H
00010
00011 #include <string.h>
00012 #include <stdio.h>
00013 #include <dirent.h>
00014 #include <stdlib.h>
00015 #include <ctype.h>
00016
00017 #include "stringtools.h"
00018 #include "chirp_protocol.h"
00019 #include "int_sizes.h"
00020 #include "link.h"
00021
00022 #define CACHE_DIR ".__cache"
00023 #define GROUPNAME_MAX 256
00024 #define USERNAME_MAX 256
00025 #define HOSTNAME_MAX 256
00026 #define NO_CACHING 0
00027 #define DECISION 1
00028 #define GROUP_FILE 2
00029
00030 extern struct list *cache_file_index;
00031 extern struct list *dec_cache_list;
00032 extern struct list *cache_policy_list;
00033
00034
00035
00036 struct cache_file {
00037 char grp_name[GROUPNAME_MAX];
00038 char file_name[USERNAME_MAX];
00039 time_t expiration;
00040 };
00041
00042
00043
00044 struct decision {
00045 char grp_name[GROUPNAME_MAX];
00046 char usr_name[USERNAME_MAX];
00047 time_t expiration;
00048 INT64_T result;
00049 };
00050
00051
00052
00053 struct policy {
00054 char grp_name[GROUPNAME_MAX];
00055 time_t file_exp;
00056 time_t dec_exp;
00057 int file_duration;
00058 int dec_duration;
00059 int policy;
00060 };
00061
00062 INT64_T chirp_group_create(char* path);
00063
00064 INT64_T chirp_group_add_user(char* path, char* usr_name);
00065
00066 INT64_T chirp_group_delete_user(char* path, char* usr_name);
00067
00068 INT64_T chirp_group_empty_file_cache(const char* path);
00069
00070 INT64_T chirp_group_check_cache_time(const char* virtual_path, const time_t cache_mod_time);
00071
00072 INT64_T chirp_group_get_policy_from_db(const char* grp_name, int* cache_file_exp, int* cache_dec_exp);
00073
00074 INT64_T chirp_group_do_lookup(char* grp_name, const char* usr_name, time_t timeout);
00075
00076 INT64_T chirp_group_remote_lookup(char* grp_name, const char* usr_name, time_t stoptime);
00077
00078 INT64_T chirp_group_set_policy(char* path, int file_cache_exp, int dec_cache_exp);
00079
00080 void chirp_group_set_dir(const char* path);
00081
00082 void chirp_group_set_local_timeout(INT64_T timeout);
00083
00084 void chirp_group_parse_group_name(const char* grp_name, char* hostport, char* path);
00085
00086 INT64_T chirp_group_list( const char *group, struct link *link, time_t stoptime );
00087
00088 INT64_T is_group(char* line);
00089
00090 #endif
00091