added COPYING and 'modified by'
[libha.git] / src / libha.h
blobd613f1006be4929bc7628cf56d6a67ca999bb436
1 /***********************************************************************
2 * This file is part of HA, a general purpose file archiver.
3 * Copyright (C) 1995 Harri Hirvola
4 * Modified by Ketmar // Invisible Vector
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 ***********************************************************************/
20 #ifndef LIBHA_H
21 #define LIBHA_H
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
28 /******************************************************************************/
29 enum {
30 LIBHA_ERR_OK = 0,
31 LIBHA_ERR_READ = -1,
32 LIBHA_ERR_WRITE = -2,
33 LIBHA_ERR_MEMORY = -3,
34 LIBHA_ERR_OTHER = -4
38 /******************************************************************************/
39 enum {
40 LIBHA_FOK = 0,
41 LIBHA_FEOF = -1,
42 LIBHA_FERR = -2
46 typedef struct libha_io_s {
47 int (*get_byte) (void *udata); /* 0..255: byte; LIBHA_EOF or LIBHA_FERR */
48 int (*put_byte) (int c, void *udata); /* <0: error; 0: ok */
49 int (*flush) (void *udata); /* <0: error; 0: ok */
50 } libha_io_t;
53 /******************************************************************************/
54 typedef struct asc_s *asc_t;
57 extern asc_t asc_alloc (const libha_io_t *iot, void *udata);
58 extern void asc_free (asc_t asc);
60 extern const libha_io_t *asc_get_iot (asc_t asc);
61 extern int asc_set_iot (asc_t asc, const libha_io_t *iot); /* <0: error; 0: ok */
63 extern void *asc_get_udata (asc_t asc);
64 extern int asc_set_udata (asc_t asc, void *udata); /* <0: error; 0: ok */
66 /* there is no real need to call asc_cleanup() except if you longjmp()ed from i/o handler */
67 extern void asc_cleanup (asc_t asc);
69 /* you need to set i/o structure before calling pack or unpack */
70 extern int asc_pack (asc_t asc); /* LIBHA_ERR_xxx */
71 extern int asc_unpack (asc_t asc); /* LIBHA_ERR_xxx */
74 #ifdef __cplusplus
76 #endif
77 #endif