meanwhile: mw_debug.h File Reference

# mw_debug.h File Reference

`#include <stdarg.h>`
`#include <glib.h>`
`#include "mw_common.h"`

Go to the source code of this file.

## Defines
#define | g_debug(format...) g_log(G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, format)
#define | g_info(format...) g_log(G_LOG_DOMAIN, G_LOG_LEVEL_INFO, format)
#define | MW_MAILME_ADDRESS "meanwhile-devel@lists.sourceforge.net"
| email address used in mw_debug_mailme.
#define | MW_MAILME_CUT_START "-------- begin copy --------"
#define | MW_MAILME_CUT_STOP "--------- end copy ---------"
#define | MW_MAILME_MESSAGE
| message used in mw_debug_mailme instructing user on what to do with the debugging output produced from that function
#define | NSTR(str) ((str)? (str): "(null)")
| replaces NULL strings with "(null)".
## Functions
void | mw_debug_data (const guchar *buf, gsize len, const char *info,...)
void | mw_debug_datav (const guchar *buf, gsize len, const char *info, va_list args)
void | mw_debug_opaque (struct mwOpaque *o, const char *info,...)
void | mw_debug_opaquev (struct mwOpaque *o, const char *info, va_list args)
void | mw_mailme_data (const guchar *buf, gsize len, const char *info,...)
void | mw_mailme_datav (const guchar *buf, gsize len, const char *info, va_list args)
void | mw_mailme_opaque (struct mwOpaque *o, const char *info,...)
| Outputs a hex dump of a mwOpaque with debugging info and a pre-defined message.
void | mw_mailme_opaquev (struct mwOpaque *o, const char *info, va_list args)
| Outputs a hex dump of a mwOpaque with debugging info and a pre-defined message.

## Define Documentation

#define g_debug | ( | format... |  | ) | g_log(G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, format)

#define g_info | ( | format... |  | ) | g_log(G_LOG_DOMAIN, G_LOG_LEVEL_INFO, format)

#define MW_MAILME_ADDRESS "meanwhile-devel@lists.sourceforge.net"

email address used in mw_debug_mailme.

#define MW_MAILME_CUT_START "-------- begin copy --------"

#define MW_MAILME_CUT_STOP "--------- end copy ---------"

#define MW_MAILME_MESSAGE

Value:

    "\n" \
     "  Greetings! It seems that you've run across protocol data that the\n" \
     "Meanwhile library does not yet know about. As such, there may be\n"    \
     "some unexpected behaviour in this session. If you'd like to help\n"    \
     "resolve this issue, please copy and paste the following block into\n"  \
     "an email to the address listed below with a brief explanation of\n"    \
     "what you were doing at the time of this message. Thanks a lot!"

message used in mw_debug_mailme instructing user on what to do with the debugging output produced from that function

#define NSTR | ( | str |  | ) | ((str)? (str): "(null)")

replaces NULL strings with "(null)".

useful for printf where you're unsure that the s will be non-NULL. Note that while the linux printf will do this automatically, not all will. The others will instead segfault

## Function Documentation

void mw_debug_data | ( | const guchar * | buf,
|  | gsize | len,
|  | const char * | info,
|  |  | ... |
| ) |  |  |

void mw_debug_datav | ( | const guchar * | buf,
|  | gsize | len,
|  | const char * | info,
|  | va_list | args |
| ) |  |  |

void mw_debug_opaque | ( | struct mwOpaque * | o,
|  | const char * | info,
|  |  | ... |
| ) |  |  |

void mw_debug_opaquev | ( | struct mwOpaque * | o,
|  | const char * | info,
|  | va_list | args |
| ) |  |  |

void mw_mailme_data | ( | const guchar * | buf,
|  | gsize | len,
|  | const char * | info,
|  |  | ... |
| ) |  |  |

void mw_mailme_datav | ( | const guchar * | buf,
|  | gsize | len,
|  | const char * | info,
|  | va_list | args |
| ) |  |  |

void mw_mailme_opaque | ( | struct mwOpaque * | o,
|  | const char * | info,
|  |  | ... |
| ) |  |  |

Outputs a hex dump of a mwOpaque with debugging info and a pre-defined message.

if MW_MAILME is undefined or false, this function acts the same as mw_mailme_opaque.

- block data to be printed in a hex block
- info a printf-style format string

The resulting message is in the following format:

        MW_MAILME_MESSAGE
        " Please send mail to: " MW_MAILME_ADDRESS
        MW_MAILME_CUT_START
        info
        block
        MW_MAILME_CUT_STOP

void mw_mailme_opaquev | ( | struct mwOpaque * | o,
|  | const char * | info,
|  | va_list | args |
| ) |  |  |

Outputs a hex dump of a mwOpaque with debugging info and a pre-defined message.

Identical to mw_mailme_opaque, but taking a va_list argument