X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fjournal-remote%2Fjournal-remote-parse.h;h=8499f4eb828cf7a325b19a07b31fb55f622dae99;hb=d920e59c7df63300e5b5191d2a4be7b3baac6ea8;hp=2b6c24ef3ac3d0c6df4cb431b3ead393209fe80c;hpb=851d4e2a67efb2c8777df151b697391ff1a76af0;p=elogind.git diff --git a/src/journal-remote/journal-remote-parse.h b/src/journal-remote/journal-remote-parse.h index 2b6c24ef3..8499f4eb8 100644 --- a/src/journal-remote/journal-remote-parse.h +++ b/src/journal-remote/journal-remote-parse.h @@ -33,30 +33,36 @@ typedef enum { } source_state; typedef struct RemoteSource { - char* name; + char *name; int fd; + bool passive_fd; char *buf; - size_t size; - size_t scanned; - size_t filled; - size_t data_size; + size_t size; /* total size of the buffer */ + size_t offset; /* offset to the beginning of live data in the buffer */ + size_t scanned; /* number of bytes since the beginning of data without a newline */ + size_t filled; /* total number of bytes in the buffer */ + size_t data_size; /* size of the binary data chunk being processed */ struct iovec_wrapper iovw; source_state state; dual_timestamp ts; + Writer *writer; + sd_event_source *event; } RemoteSource; -static inline int source_non_empty(RemoteSource *source) { +RemoteSource* source_new(int fd, bool passive_fd, char *name, Writer *writer); + +static inline size_t source_non_empty(RemoteSource *source) { assert(source); - return source->filled > 0; + return source->filled; } void source_free(RemoteSource *source); int process_data(RemoteSource *source); int push_data(RemoteSource *source, const char *data, size_t size); -int process_source(RemoteSource *source, Writer *writer, bool compress, bool seal); +int process_source(RemoteSource *source, bool compress, bool seal);