1 /* standard include files for all modules associated with the database */
6 #include "../database/database.h"
8 #include "../lib/misc.h"
10 #define SVC(x) x ## _svc
15 /* this is the directory containing the database files */
18 /* some special keys for the database */
19 #define DOMAIN_KEY "_DOMAIN_" /* the domain of the database.. not */
21 #define STATUS_KEY "_STATUS_" /* the status of the database.. the */
22 /* update time, reorg time */
23 #define ATTR_TYPE_KEY "_ATTR_TYPE_1_"
24 #define HOST_SETS "_HOSTS_SETS_" /* key of the sets in the hosts */
26 #define LogFile "db_log"
28 /* some stuff for bitstrings */
29 #define BITSTRLEN 16 /* size in characters */
30 #define BITINDMAX BITSTRLEN * sizeof(char) *8 /* size in bits */
32 #define MAXCHANGES 20 /* the maximum number of changes to transfer in */
35 #define PRIV_REFUND_FLAG 0x8000
38 #include "db_globals.h"
40 #include "db_extern.h"
45 typedef struct CLIENTHOST {
50 #define Malloc(ptr,type) ptr=(type *)malloc(sizeof(type));if (ptr == NULL) {printf("no memory\n"); exit(33); }
56 /* from descpairlist.c */
57 void add_to_descpairlist(descpairlist * ch, description * new, int num);
58 book_changeres del_from_descpairlist(descpairlist * ch, description *name);
59 descpairlist finddesc(descpairlist *ch, description * key);
60 void incdesc(descpairlist *ch, description * key, int diff);
63 query_reply * generic_query(query_req * query);
64 int db_open(db_number db, int gdbm_mode);
65 void close_db(db_number db);
66 book_changeres read_db(item key, void * data, int data_size, xdrproc_t xdr_fn, db_number db );
67 book_changeres update_status_key(db_number db, int update_time, int reorganise_time);
68 void get_status_key(db_number db, time_t *update_time, time_t *reorganise_time);
69 book_changeres write_db(item key, void * data, xdrproc_t xdr_fn, db_number db);
70 book_changeres delete_from_db(item key, db_number db);
72 /* from config_db.c */
73 book_changeres change_implication(impls * impl);
74 void init_attr_types();
75 book_changeres change_attr_type(attr_type_desc *attrs);
76 book_changeres change_configdata(configdata * configent);
79 /* from db_change.c */
80 void get_replica_header(char *host);
81 void sync_replica_header();
82 int change_init(void);
83 void close_change(void);
84 book_changeres commit(book_changeent *ch);
85 void free_changes(change_reply reply);
86 void change_del_changes(char *replica, int highest);
88 /* from replica_db.c */
89 int replica_grow(machine_name machine, replica_no height);
90 book_changeres replica_add(machine_name server);
91 book_changeres replica_del(machine_name server);
94 /* from db_transfer */
95 void collect_xfer(void);
96 void send_database(int sock, db_number db);
99 book_changeres add_user_booking(book_req * booking, int clientreq);
100 book_changeres change_user_booking(book_chng * bchanges, int *refund, int *tokens, int *who_by);
101 book_changeres del_user_booking(bookuid_t user, int when, book_key *bk);
102 book_changeres del_user(bookuid_t user);
104 /* from bookings_db.c */
105 book_changeres add_booking_to_list(bookhead * blist, book_req *req);
106 book_changeres incuser(bookhead *bh, book_req *req);
107 book_changeres read_bookhead(bookhead *bh, book_key *key);
108 book_changeres write_bookhead(bookhead *bh, book_key *key);
109 book_changeres add_booking(book_req * booking);
110 int inc_usage_count(slotgroup *slot, int number);
111 book_changeres change_booking(book_chng *bchanges, int *refund, int *tokens, int *who_by);
112 booklist map_bookings(bookuid_t user, userbookinglist list);
113 book_changeres remove_booking(book_key * removal);
115 /* from classes_db.c */
116 book_changeres add_class(class_req * cl_req);
117 book_changeres set_allotment(int uid, int tok, int cnt);
120 /* from freeslots.c */
121 utilizationlist *free_slots(slotlist sl);
124 bool_t open_dbs(int gdbm_stat);
125 void close_dbs(void);
127 void close_all(void);
128 void start_helper(void);
129 void kill_helper(void);
131 void check_update_status(void);