Adding upstream version 6.02~pre8+dfsg.
[syslinux-debian/hramrach.git] / com32 / libupload / upload_backend.h
blob7ea03e462c53200a00d2350392e6ebd4fbb06906
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"
9 #include "tftp.h"
11 /* Backend flags */
12 #define BE_NEEDLEN 0x01
14 struct upload_backend {
15 const char *name;
16 const char *helpmsg;
17 int minargs;
19 size_t dbytes;
20 size_t zbytes;
21 const char **argv;
23 uint32_t now;
25 int (*write)(struct upload_backend *);
27 z_stream zstream;
28 char *outbuf;
29 size_t alloc;
32 /* zout.c */
33 int init_data(struct upload_backend *be, const char *argv[]);
34 int write_data(struct upload_backend *be, const void *buf, size_t len);
35 int flush_data(struct upload_backend *be);
37 /* cpio.c */
38 #define cpio_init init_data
39 int cpio_hdr(struct upload_backend *be, uint32_t mode, size_t datalen,
40 const char *filename);
41 int cpio_mkdir(struct upload_backend *be, const char *filename);
42 int cpio_writefile(struct upload_backend *be, const char *filename,
43 const void *data, size_t len);
44 int cpio_close(struct upload_backend *be);
45 #define MODE_FILE 0100644
46 #define MODE_DIR 0040755
48 /* backends.c */
49 struct upload_backend *get_upload_backend(const char *name);
51 /* backends */
52 extern struct upload_backend upload_tftp;
53 extern struct upload_backend upload_ymodem;
54 extern struct upload_backend upload_srec;
56 #endif /* BACKEND_H */