2 * FILE: $Header: /home/egg/src/RCS/storage.h,v 1.3 1998/12/31 22:11:05 ghn Exp $
3 * PURPOSE: Definitions for data storage functions
9 * Revision 1.3 1998/12/31 22:11:05 ghn
10 * Rev 5 code: includes multi-reg support, HTML, etc.
12 * Revision 1.2 1998/08/01 17:19:48 ghn
13 * Added ResetDatabase function.
15 * Revision 1.1 1998/07/21 11:35:10 ghn
18 * Copyright 1998 - Greg Nelson
19 * Redistributable under the terms of the GNU Public Licence (GPL)
22 typedef struct dbase {
28 /* The initialization provides a way to specify a format for the
29 database file names. If the argument is null, it uses a default
30 from the environment, or a compiled default. This string is used
31 as an argument to strftime(3) which replaces certain characters
32 with corresponding fields of the date and time. This provides an
33 automatic way of generating a logical new filename on a periodic
36 The other function of the initialization is to clear static
37 variable used to incrementally collect records for SaveRecord until
38 a complete packet is available for storage to disk. */
39 extern int32 InitStorage(char *path);
41 /* Save packet is the basic save function. It does not take a
42 filename, relying on the datafmt variable created during
43 initialization to generate an appropriate filename. The
44 date for the saved data is based on the timestamp of the packet's
46 extern int32 SavePacket(EggCarton *cart);
48 /* Open database for reading, positioning to specified location.
49 If eggid is less than zero, it will load any packet. */
50 extern int32 OpenDatabase(DBRec *db, uint32 tindex, int16 eggid);
53 extern int32 CloseDatabase(DBRec *db);
55 /* Reset database allows us to open same file name again. */
56 extern int32 ResetDatabase(DBRec *dbp);
58 /* Load next packet following a particular time index and egg id. If
59 eggid is less than zero, it will load any packet. This is
60 essentially a shortcut for getting one packet. */
62 extern int32 LoadPacket(uint32 tindex, int16 eggid, EggCarton *cart);