From: DINH V. H. <ho...@us...> - 2010-03-21 15:54:16
|
Update of /cvsroot/libetpan/libetpan/src/data-types In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv8909/src/data-types Modified Files: mailstream.h mailstream_low.c Log Message: log by stream Index: mailstream.h =================================================================== RCS file: /cvsroot/libetpan/libetpan/src/data-types/mailstream.h,v retrieving revision 1.18 retrieving revision 1.19 diff -u -d -r1.18 -r1.19 --- mailstream.h 28 Jan 2007 16:00:18 -0000 1.18 +++ mailstream.h 21 Mar 2010 15:54:06 -0000 1.19 @@ -73,6 +73,9 @@ LIBETPAN_EXPORT extern void (* mailstream_logger)(int direction, const char * str, size_t size); +LIBETPAN_EXPORT +extern void (* mailstream_logger_id)(mailstream_low * s, int is_stream_data, int direction, + const char * str, size_t size); #endif #define LIBETPAN_MAILSTREAM_NETWORK_DELAY Index: mailstream_low.c =================================================================== RCS file: /cvsroot/libetpan/libetpan/src/data-types/mailstream_low.c,v retrieving revision 1.19 retrieving revision 1.20 diff -u -d -r1.19 -r1.20 --- mailstream_low.c 27 Oct 2007 10:08:24 -0000 1.19 +++ mailstream_low.c 21 Mar 2010 15:54:06 -0000 1.20 @@ -64,10 +64,16 @@ LIBETPAN_EXPORT void (* mailstream_logger)(int direction, const char * str, size_t size) = NULL; +LIBETPAN_EXPORT +void (* mailstream_logger_id)(mailstream_low * s, int is_stream_data, int direction, + const char * str, size_t size) = NULL; -#define STREAM_LOG_BUF(direction, buf, size) \ +#define STREAM_LOG_BUF(low, direction, buf, size) \ if (mailstream_debug) { \ - if (mailstream_logger != NULL) { \ + if (mailstream_logger_id != NULL) { \ + mailstream_logger_id(low, 1, direction, buf, size); \ + } \ + else if (mailstream_logger != NULL) { \ mailstream_logger(direction, buf, size); \ } \ else { \ @@ -86,10 +92,13 @@ } \ } -#define STREAM_LOG(direction, str) \ +#define STREAM_LOG(low, direction, str) \ if (mailstream_debug) { \ - if (mailstream_logger != NULL) { \ - mailstream_logger(direction, str, strlen(str) + 1); \ + if (mailstream_logger_id != NULL) { \ + mailstream_logger_id(low, 0, direction, str, strlen(str)); \ + } \ + else if (mailstream_logger != NULL) { \ + mailstream_logger(direction, str, strlen(str)); \ } \ else { \ FILE * f; \ @@ -109,8 +118,8 @@ #else -#define STREAM_LOG_BUF(direction, buf, size) do { } while (0) -#define STREAM_LOG(direction, buf) do { } while (0) +#define STREAM_LOG_BUF(low, direction, buf, size) do { } while (0) +#define STREAM_LOG(low, direction, buf) do { } while (0) #endif @@ -163,10 +172,10 @@ #ifdef STREAM_DEBUG if (r > 0) { - STREAM_LOG(0, "<<<<<<< read <<<<<<\n"); - STREAM_LOG_BUF(0, buf, r); - STREAM_LOG(0, "\n"); - STREAM_LOG(0, "<<<<<<< end read <<<<<<\n"); + 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 @@ -180,10 +189,10 @@ return -1; #ifdef STREAM_DEBUG - STREAM_LOG(1, ">>>>>>> send >>>>>>\n"); - STREAM_LOG_BUF(1, buf, count); - STREAM_LOG(1, "\n"); - STREAM_LOG(1, ">>>>>>> end send >>>>>>\n"); + STREAM_LOG(s, 1, ">>>>>>> send >>>>>>\n"); + STREAM_LOG_BUF(s, 1, buf, count); + STREAM_LOG(s, 1, "\n"); + STREAM_LOG(s, 1, ">>>>>>> end send >>>>>>\n"); #endif return s->driver->mailstream_write(s, buf, count); |