Adding upstream version 4.00~pre54+dfsg.
[syslinux-debian/hramrach.git] / com32 / sysdump / backend.h
blob0926c8d570e08e1348ad705ab8df52765e6c45fb
1 #ifndef BACKEND_H
2 #define BACKEND_H
4 #include <stddef.h>
5 #include <inttypes.h>
6 #include <stdbool.h>
7 #include <zlib.h>
8 #include "serial.h"
10 /* Backend flags */
11 #define BE_NEEDLEN 0x01
13 struct backend {
14 const char *name;
15 const char *helpmsg;
16 int minargs;
18 size_t dbytes;
19 size_t zbytes;
20 const char **argv;
22 uint32_t now;
24 int (*write)(struct backend *);
26 z_stream zstream;
27 char *outbuf;
28 size_t alloc;
31 /* zout.c */
32 int init_data(struct backend *be, const char *argv[]);
33 int write_data(struct backend *be, const void *buf, size_t len);
34 int flush_data(struct backend *be);
36 /* cpio.c */
37 #define cpio_init init_data
38 int cpio_hdr(struct backend *be, uint32_t mode, size_t datalen,
39 const char *filename);
40 int cpio_mkdir(struct backend *be, const char *filename);
41 int cpio_writefile(struct backend *be, const char *filename,
42 const void *data, size_t len);
43 int cpio_close(struct backend *be);
44 #define MODE_FILE 0100644
45 #define MODE_DIR 0040755
47 /* backends.c */
48 struct backend *get_backend(const char *name);
50 /* backends */
51 extern struct backend be_tftp;
52 extern struct backend be_ymodem;
54 #endif /* BACKEND_H */