File: upload_backend.h

package info (click to toggle)
syslinux 3%3A6.04~git20190206.bf6db5b4%2Bdfsg1-3.2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 17,020 kB
  • sloc: ansic: 189,354; asm: 5,148; pascal: 4,825; makefile: 1,981; perl: 1,980; python: 266; sh: 185; xml: 39
file content (56 lines) | stat: -rw-r--r-- 1,320 bytes parent folder | download | duplicates (8)
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
45
46
47
48
49
50
51
52
53
54
55
56
#ifndef BACKEND_H
#define BACKEND_H

#include <stddef.h>
#include <inttypes.h>
#include <stdbool.h>
#include <zlib.h>
#include "serial.h"
#include "tftp.h"

/* Backend flags */
#define BE_NEEDLEN	0x01

struct upload_backend {
    const char *name;
    const char *helpmsg;
    int minargs;

    size_t dbytes;
    size_t zbytes;
    const char **argv;

    uint32_t now;

    int (*write)(struct upload_backend *);

    z_stream zstream;
    char *outbuf;
    size_t alloc;
};

/* zout.c */
int init_data(struct upload_backend *be, const char *argv[]);
int write_data(struct upload_backend *be, const void *buf, size_t len);
int flush_data(struct upload_backend *be);

/* cpio.c */
#define cpio_init init_data
int cpio_hdr(struct upload_backend *be, uint32_t mode, size_t datalen,
	     const char *filename);
int cpio_mkdir(struct upload_backend *be, const char *filename);
int cpio_writefile(struct upload_backend *be, const char *filename,
		   const void *data, size_t len);
int cpio_close(struct upload_backend *be);
#define MODE_FILE	0100644
#define MODE_DIR	0040755

/* backends.c */
struct upload_backend *get_upload_backend(const char *name);

/* backends */
extern struct upload_backend upload_tftp;
extern struct upload_backend upload_ymodem;
extern struct upload_backend upload_srec;

#endif /* BACKEND_H */