chiark / gitweb /
journal-remote: process events without delay
[elogind.git] / src / journal-remote / journal-remote-parse.h
index c1506d118d73759fe4975abc5a602d0150440ca4..06a50296a184077646ad7332da9d97fd82a621a6 100644 (file)
@@ -33,29 +33,39 @@ typedef enum {
 } source_state;
 
 typedef struct RemoteSource {
 } source_state;
 
 typedef struct RemoteSource {
-        charname;
+        char *name;
         int fd;
         int fd;
+        bool passive_fd;
 
         char *buf;
 
         char *buf;
-        size_t size;
-        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 field_len;  /* used for binary fields: the field name length */
+        size_t data_size;  /* and the size of the binary data chunk being processed */
 
         struct iovec_wrapper iovw;
 
         source_state state;
         dual_timestamp ts;
 
 
         struct iovec_wrapper iovw;
 
         source_state state;
         dual_timestamp ts;
 
+        Writer *writer;
+
         sd_event_source *event;
         sd_event_source *event;
+        sd_event_source *buffer_event;
 } RemoteSource;
 
 } 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);
 
         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);
 }
 
 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);