1 #ifndef __SQUISH_H__ 2 #define __SQUISH_H__ 3 4 /* 5 ** File extensions 6 */ 7 #define EXT_SQDFILE ".sqd" 8 #define EXT_SQIFILE ".sqi" 9 #define EXT_SQLFILE ".sql" 10 11 typedef long FOFS; 12 13 #define NULL_FRAME ((FOFS)0L) 14 #define FRAME_normal 0x00 15 #define FRAME_free 0x01 16 #define FRAME_rle 0x02 /* not implemented */ 17 #define FRAME_lzw 0x03 /* not implemented */ 18 19 #define EVERYTHING 0xffffu 20 21 #define SFB_LEN 2048 22 #define IFB_LEN 1024 23 24 #define EXTRA_BUF 16 25 26 27 typedef struct _sqbase 28 { 29 word len; /* LENGTH OF THIS STRUCTURE! */ /* 0 */ 30 word rsvd1; /* reserved */ /* 2 */ 31 32 dword num_msg; /* Number of messages in area */ /* 4 */ 33 dword high_msg; /* Highest msg in area. Same as num_msg */ /* 8 */ 34 dword skip_msg; /* Skip killing first x msgs in area */ /* 12 */ 35 dword high_water; /* Msg# (not umsgid) of HWM */ /* 16 */ 36 37 dword uid; /* Number of the next UMSGID to use */ /* 20 */ 38 39 byte base[80]; /* Base name of SquishFile */ /* 24 */ 40 41 FOFS begin_frame; /* Offset of first frame in file */ /* 104 */ 42 FOFS last_frame; /* Offset to last frame in file */ /* 108 */ 43 FOFS free_frame; /* Offset of first FREE frame in file */ /* 112 */ 44 FOFS last_free_frame; /* Offset of last free frame in file */ /* 116 */ 45 FOFS end_frame; /* Pointer to end of file */ /* 120 */ 46 47 dword max_msg; /* Max # of msgs to keep in area */ /* 124 */ 48 word keep_days; /* Max age of msgs in area (SQPack) */ /* 128 */ 49 word sz_sqhdr; /* sizeof(SQHDR) */ /* 130 */ 50 byte rsvd2[124]; /* Reserved by Squish for future use */ /* 132 */ 51 52 /* total: 256 */ 53 } SQBASE, *SQBASEptr; 54 55 #define SQBASE_SIZE 256 56 57 #define SQHDRID 0xAFAE4453UL 58 59 typedef struct 60 { 61 dword id; /* id must always equal SQHDRID */ 62 63 FOFS next_frame; 64 FOFS prev_frame; 65 66 dword frame_length; 67 dword msg_length; 68 dword clen; 69 70 word frame_type; 71 word rsvd; 72 } SQHDR, *SQHDRptr; 73 74 #define SQHDR_SIZE 28 75 76 77 typedef struct 78 { 79 FOFS ofs; 80 UMSGID umsgid; 81 dword hash; 82 } SQIDX, *SQIDXptr; 83 84 #define SQIDX_SIZE 12 85 86 int read_xmsg(int handle, XMSG *pxmsg); 87 int write_xmsg(int handle, XMSG *pxmsg); 88 int read_sqhdr(int, SQHDR *); 89 int write_sqhdr(int, SQHDR *); 90 int read_sqidx(int, SQIDX *, dword); 91 int write_sqidx(int, SQIDX *, dword); 92 int read_sqbase(int handle, struct _sqbase *psqbase); 93 int write_sqbase(int handle, struct _sqbase *psqbase); 94 95 #endif 96 97