ostream-rawlog.c revision f1ed4fa248aaf6841ba638b9d66b2738d9f7aa18
c25356d5978632df6203437e1953bcb29e0c736fTimo Sirainen/* Copyright (c) 2011-2012 Dovecot authors, see the included COPYING file */
8c909e451d14075c05d90382cf8eebc4e354f569Timo Sirainenstatic void o_stream_rawlog_close(struct iostream_private *stream)
8c909e451d14075c05d90382cf8eebc4e354f569Timo Sirainen struct rawlog_ostream *rstream = (struct rawlog_ostream *)stream;
573f0491a5733fe21fa062a455acb4790b4e0499Timo Sirainen (void)o_stream_flush(rstream->ostream.parent);
1a5573ebc32fae2fe576ec544e1781323c1db609Timo Siraineno_stream_rawlog_sendv(struct ostream_private *stream,
8e371a3ce32bd64288786855b8ce0cb63f19f7d1Timo Sirainen const struct const_iovec *iov, unsigned int iov_count)
8e371a3ce32bd64288786855b8ce0cb63f19f7d1Timo Sirainen struct rawlog_ostream *rstream = (struct rawlog_ostream *)stream;
8e371a3ce32bd64288786855b8ce0cb63f19f7d1Timo Sirainen unsigned int i;
8e371a3ce32bd64288786855b8ce0cb63f19f7d1Timo Sirainen for (i = 0; i < iov_count; i++) {
f7539a17ea306191b53b8f5e752e228937df9ec3Timo Sirainen if ((ret = o_stream_sendv(stream->parent, iov, iov_count)) < 0) {
2615df45a8027948a474abe5e817b34b0499c171Timo Siraineno_stream_create_rawlog(struct ostream *output, const char *rawlog_path,
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen int rawlog_fd, enum iostream_rawlog_flags flags)
857c471c13ca215f4be9dd4b336b742b8d434e31Timo Sirainen rstream->ostream.sendv = o_stream_rawlog_sendv;
857c471c13ca215f4be9dd4b336b742b8d434e31Timo Sirainen rstream->ostream.iostream.close = o_stream_rawlog_close;
fdc557286bc9f92c5f3bb49096ff6e2bcec0ea79Timo Sirainen rstream->riostream.rawlog_path = i_strdup(rawlog_path);
8e371a3ce32bd64288786855b8ce0cb63f19f7d1Timo Sirainen iostream_rawlog_init(&rstream->riostream, flags, FALSE);