be6ad6e46ecb8c7126b421819046e7f4857a2babTimo Sirainen#ifndef IOSTREAM_RAWLOG_H
be6ad6e46ecb8c7126b421819046e7f4857a2babTimo Sirainen#define IOSTREAM_RAWLOG_H
be6ad6e46ecb8c7126b421819046e7f4857a2babTimo Sirainen
76a58bc863893374000881e69d6dd4e3dccadddeTimo Sirainenenum iostream_rawlog_flags {
76a58bc863893374000881e69d6dd4e3dccadddeTimo Sirainen IOSTREAM_RAWLOG_FLAG_AUTOCLOSE = 0x01,
76a58bc863893374000881e69d6dd4e3dccadddeTimo Sirainen IOSTREAM_RAWLOG_FLAG_BUFFERED = 0x02,
76a58bc863893374000881e69d6dd4e3dccadddeTimo Sirainen IOSTREAM_RAWLOG_FLAG_TIMESTAMP = 0x04
76a58bc863893374000881e69d6dd4e3dccadddeTimo Sirainen};
76a58bc863893374000881e69d6dd4e3dccadddeTimo Sirainen
f1ed4fa248aaf6841ba638b9d66b2738d9f7aa18Timo Sirainen/* Create rawlog *.in and *.out files to the given directory. */
b66d803de86bfb411165b3465b0d9ef64ecfe2a1Timo Sirainenint ATTR_NOWARN_UNUSED_RESULT
b66d803de86bfb411165b3465b0d9ef64ecfe2a1Timo Siraineniostream_rawlog_create(const char *dir, struct istream **input,
b66d803de86bfb411165b3465b0d9ef64ecfe2a1Timo Sirainen struct ostream **output);
f1ed4fa248aaf6841ba638b9d66b2738d9f7aa18Timo Sirainen/* Create rawlog prefix.in and prefix.out files. */
f1ed4fa248aaf6841ba638b9d66b2738d9f7aa18Timo Sirainenint ATTR_NOWARN_UNUSED_RESULT
f1ed4fa248aaf6841ba638b9d66b2738d9f7aa18Timo Siraineniostream_rawlog_create_prefix(const char *prefix, struct istream **input,
f1ed4fa248aaf6841ba638b9d66b2738d9f7aa18Timo Sirainen struct ostream **output);
f1ed4fa248aaf6841ba638b9d66b2738d9f7aa18Timo Sirainen/* Create rawlog path, writing both input and output to the same file. */
f1ed4fa248aaf6841ba638b9d66b2738d9f7aa18Timo Sirainenint ATTR_NOWARN_UNUSED_RESULT
f1ed4fa248aaf6841ba638b9d66b2738d9f7aa18Timo Siraineniostream_rawlog_create_path(const char *path, struct istream **input,
f1ed4fa248aaf6841ba638b9d66b2738d9f7aa18Timo Sirainen struct ostream **output);
76d4ff1c1b31a1a09f6cbfe613a8d0efe62cbfd2Timo Sirainen/* Create rawlog that appends to the given rawlog_output.
76d4ff1c1b31a1a09f6cbfe613a8d0efe62cbfd2Timo Sirainen Both input and output are written to the same stream. */
76d4ff1c1b31a1a09f6cbfe613a8d0efe62cbfd2Timo Sirainenvoid iostream_rawlog_create_from_stream(struct ostream *rawlog_output,
76d4ff1c1b31a1a09f6cbfe613a8d0efe62cbfd2Timo Sirainen struct istream **input,
76d4ff1c1b31a1a09f6cbfe613a8d0efe62cbfd2Timo Sirainen struct ostream **output);
be6ad6e46ecb8c7126b421819046e7f4857a2babTimo Sirainen
be6ad6e46ecb8c7126b421819046e7f4857a2babTimo Sirainen#endif