fork of PCE focusing on macplus, supporting DaynaPort SCSI network emulation
1/*****************************************************************************
2 * pce *
3 *****************************************************************************/
4
5/*****************************************************************************
6 * File name: src/lib/ciff.h *
7 * Created: 2022-02-12 by Hampa Hug <hampa@hampa.ch> *
8 * Copyright: (C) 2022 Hampa Hug <hampa@hampa.ch> *
9 *****************************************************************************/
10
11/*****************************************************************************
12 * This program is free software. You can redistribute it and / or modify it *
13 * under the terms of the GNU General Public License version 2 as published *
14 * by the Free Software Foundation. *
15 * *
16 * This program is distributed in the hope that it will be useful, but *
17 * WITHOUT ANY WARRANTY, without even the implied warranty of *
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General *
19 * Public License for more details. *
20 *****************************************************************************/
21
22
23#ifndef PCE_LIB_CIFF_H
24#define PCE_LIB_CIFF_H 1
25
26
27#include <stdint.h>
28#include <stdio.h>
29
30
31typedef struct {
32 FILE *fp;
33
34 uint32_t crc;
35
36 uint32_t ckid;
37 uint32_t cksize;
38
39 uint32_t size;
40
41 char in_chunk;
42 char use_crc;
43 char crc_error;
44} ciff_t;
45
46
47void ciff_init (ciff_t *ciff, FILE *fp, int use_crc);
48void ciff_free (ciff_t *ciff);
49
50int ciff_read (ciff_t *ciff, void *buf, uint32_t cnt);
51int ciff_read_id (ciff_t *ciff);
52int ciff_read_crc (ciff_t *ciff);
53int ciff_read_chunk (ciff_t *ciff, void *buf, uint32_t size);
54
55int ciff_write (ciff_t *ciff, const void *buf, uint32_t cnt);
56int ciff_write_id (ciff_t *ciff, uint32_t ckid, uint32_t size);
57int ciff_write_crc (ciff_t *ciff);
58int ciff_write_chunk (ciff_t *ciff, uint32_t ckid, const void *buf, uint32_t size);
59
60
61
62#endif