blob: eb6530e14f115bd796d921e4b79b4324bf5f25f0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
#ifndef BACKEND_H
#define BACKEND_H
#include <stddef.h>
#include <inttypes.h>
#include <stdbool.h>
#include <zlib.h>
struct backend {
const char *name;
int blocksize;
int (*open)(struct backend *, const char *argv[]);
int (*write)(struct backend *, const char *buf, size_t len);
z_stream zstream;
char *outbuf;
union {
struct {
uint32_t my_ip;
uint32_t srv_ip;
uint16_t my_port;
uint16_t srv_port;
uint16_t seq;
} tftp;
};
};
/* zout.c */
int init_data(struct backend *be, const char *argv[]);
int write_data(struct backend *be, const void *buf, size_t len, bool flush);
/* cpio.c */
#define cpio_init init_data
int cpio_mkdir(struct backend *be, const char *filename);
int cpio_writefile(struct backend *be, const char *filename,
const void *data, size_t len);
int cpio_close(struct backend *be);
/* backends.c */
struct backend *get_backend(const char *name);
#endif /* BACKEND_H */
|