-
Notifications
You must be signed in to change notification settings - Fork 3
/
output.h
40 lines (34 loc) · 842 Bytes
/
output.h
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
/*
* Copyright 2022 zhenwei pi
*
* Authors:
* zhenwei pi <pizhenwei@bytedance.com>
*
* This work is licensed under the terms of the GNU GPL, version 2 or later.
* See the COPYING file in the top-level directory.
*/
#ifndef _OUTPUT_H_
#define _OUTPUT_H_
#include "connection.h"
enum {
OUTPUT_STDOUT,
OUTPUT_FD,
OUTPUT_BUF
};
struct output {
int output_type;
union {
/* OUTPUT_STDOUT needs no more argument */
int fd; /* for OUTPUT_FD */
struct output_buf {
char *buf;
int size; /* size of buf, auto grow if not enough */
int offset; /* offset of buf, reset to 0 for next record */
} ob; /* OUTPUT_BUF */
};
void (*done)(struct output *op, connection *conn);
char *encoding;
};
void output_samp(struct output *op, char *buf, int size);
void output_samp_done(struct output *op, connection *conn);
#endif