ssize_t mailstream_low_write(mailstream_low * s, const void * buf, size_t count) { ssize_t r; if (s == NULL) return -1; #ifdef STREAM_DEBUG STREAM_LOG(s, 1, ">>>>>>> send >>>>>>\n"); if (s->privacy) { STREAM_LOG_BUF(s, 1, buf, count); } else { STREAM_LOG_BUF(s, 2, buf, count); } STREAM_LOG(s, 1, "\n"); STREAM_LOG(s, 1, ">>>>>>> end send >>>>>>\n"); #endif r = s->driver->mailstream_write(s, buf, count); if (r < 0) { STREAM_LOG_ERROR(s, 4 | 1, buf, 0); } return r; }
ssize_t mailstream_low_read(mailstream_low * s, void * buf, size_t count) { ssize_t r; if (s == NULL) return -1; r = s->driver->mailstream_read(s, buf, count); #ifdef STREAM_DEBUG if (r > 0) { STREAM_LOG(s, 0, "<<<<<<< read <<<<<<\n"); STREAM_LOG_BUF(s, 0, buf, r); STREAM_LOG(s, 0, "\n"); STREAM_LOG(s, 0, "<<<<<<< end read <<<<<<\n"); } #endif if (r < 0) { STREAM_LOG_ERROR(s, 4, buf, 0); } return r; }
void mailstream_low_log_error(mailstream_low * s, const void * buf, size_t count) { STREAM_LOG_ERROR(s, 0, buf, count); }