]>
git.proxmox.com Git - systemd.git/blob - src/journal-remote/journal-remote-parse.h
2 This file is part of systemd.
4 Copyright 2014 Zbigniew Jędrzejewski-Szmek
6 systemd is free software; you can redistribute it and/or modify it
7 under the terms of the GNU Lesser General Public License as published by
8 the Free Software Foundation; either version 2.1 of the License, or
9 (at your option) any later version.
11 systemd is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Lesser General Public License for more details.
16 You should have received a copy of the GNU Lesser General Public License
17 along with systemd; If not, see <http://www.gnu.org/licenses/>.
24 #include "journal-remote-write.h"
27 STATE_LINE
= 0, /* waiting to read, or reading line */
28 STATE_DATA_START
, /* reading binary data header */
29 STATE_DATA
, /* reading binary data */
30 STATE_DATA_FINISH
, /* expecting newline */
34 typedef struct RemoteSource
{
40 size_t size
; /* total size of the buffer */
41 size_t offset
; /* offset to the beginning of live data in the buffer */
42 size_t scanned
; /* number of bytes since the beginning of data without a newline */
43 size_t filled
; /* total number of bytes in the buffer */
45 size_t field_len
; /* used for binary fields: the field name length */
46 size_t data_size
; /* and the size of the binary data chunk being processed */
48 struct iovec_wrapper iovw
;
55 sd_event_source
*event
;
56 sd_event_source
*buffer_event
;
59 RemoteSource
* source_new(int fd
, bool passive_fd
, char *name
, Writer
*writer
);
61 static inline size_t source_non_empty(RemoteSource
*source
) {
64 return source
->filled
;
67 void source_free(RemoteSource
*source
);
68 int push_data(RemoteSource
*source
, const char *data
, size_t size
);
69 int process_source(RemoteSource
*source
, bool compress
, bool seal
);