journal-upload.h revision eacbb4d33e2bb5c54311544851140efe3dd0f774
#pragma once
#include <inttypes.h>
#include "sd-journal.h"
#include "sd-event.h"
typedef enum {
ENTRY_CURSOR = 0, /* Nothing actually written yet. */
ENTRY_NEW_FIELD, /* In between fields. */
ENTRY_TEXT_FIELD, /* In the middle of a text field. */
ENTRY_BINARY_FIELD_START, /* Writing the name of a binary field. */
ENTRY_BINARY_FIELD_SIZE, /* Writing the size of a binary field. */
ENTRY_BINARY_FIELD, /* In the middle of a binary field. */
ENTRY_OUTRO, /* Writing '\n' */
ENTRY_DONE, /* Need to move to a new field. */
} entry_state;
typedef struct Uploader {
const char *url;
bool uploading;
char error[CURL_ERROR_SIZE];
struct curl_slist *header;
char *answer;
/* fd stuff */
int input;
/* journal stuff */
const void *field_data;
/* general metrics */
char *last_cursor;
} Uploader;
int start_upload(Uploader *u,
void *userdata),
void *data);
int open_journal_for_upload(Uploader *u,
sd_journal *j,
const char *cursor,
bool after_cursor,
bool follow);
void close_journal_input(Uploader *u);
int check_journal_input(Uploader *u);