Blame src/mw_debug.h

Packit 16808d
Packit 16808d
/*
Packit 16808d
  Meanwhile - Unofficial Lotus Sametime Community Client Library
Packit 16808d
  Copyright (C) 2004  Christopher (siege) O'Brien
Packit 16808d
  
Packit 16808d
  This library is free software; you can redistribute it and/or
Packit 16808d
  modify it under the terms of the GNU Library General Public
Packit 16808d
  License as published by the Free Software Foundation; either
Packit 16808d
  version 2 of the License, or (at your option) any later version.
Packit 16808d
  
Packit 16808d
  This library is distributed in the hope that it will be useful,
Packit 16808d
  but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 16808d
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit 16808d
  Library General Public License for more details.
Packit 16808d
  
Packit 16808d
  You should have received a copy of the GNU Library General Public
Packit 16808d
  License along with this library; if not, write to the Free
Packit 16808d
  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
Packit 16808d
*/
Packit 16808d
Packit 16808d
#ifndef _MW_DEBUG_H
Packit 16808d
#define _MW_DEBUG_H
Packit 16808d
Packit 16808d
Packit 16808d
#include <stdarg.h>
Packit 16808d
#include <glib.h>
Packit 16808d
Packit 16808d
#include "mw_common.h"
Packit 16808d
Packit 16808d
Packit 16808d
/** replaces NULL strings with "(null)". useful for printf where
Packit 16808d
    you're unsure that the %s will be non-NULL. Note that while the
Packit 16808d
    linux printf will do this automatically, not all will. The others
Packit 16808d
    will instead segfault */
Packit 16808d
#define NSTR(str) ((str)? (str): "(null)")
Packit 16808d
Packit 16808d
Packit 16808d
#ifndef g_debug
Packit 16808d
#define g_debug(format...) g_log(G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, format)
Packit 16808d
#endif
Packit 16808d
Packit 16808d
Packit 16808d
#ifndef g_info
Packit 16808d
#define g_info(format...) g_log(G_LOG_DOMAIN, G_LOG_LEVEL_INFO, format)
Packit 16808d
#endif
Packit 16808d
Packit 16808d
Packit 16808d
#ifndef MW_MAILME_ADDRESS
Packit 16808d
/** email address used in mw_debug_mailme. */
Packit 16808d
#define MW_MAILME_ADDRESS  "meanwhile-devel@lists.sourceforge.net"
Packit 16808d
#endif
Packit 16808d
Packit 16808d
Packit 16808d
#ifndef MW_MAILME_CUT_START
Packit 16808d
#define MW_MAILME_CUT_START  "-------- begin copy --------"
Packit 16808d
#endif
Packit 16808d
Packit 16808d
Packit 16808d
#ifndef MW_MAILME_CUT_STOP
Packit 16808d
#define MW_MAILME_CUT_STOP   "--------- end copy ---------"
Packit 16808d
#endif
Packit 16808d
Packit 16808d
Packit 16808d
#ifndef MW_MAILME_MESSAGE
Packit 16808d
/** message used in mw_debug_mailme instructing user on what to do
Packit 16808d
    with the debugging output produced from that function */
Packit 16808d
#define MW_MAILME_MESSAGE "\n" \
Packit 16808d
 "  Greetings! It seems that you've run across protocol data that the\n" \
Packit 16808d
 "Meanwhile library does not yet know about. As such, there may be\n"    \
Packit 16808d
 "some unexpected behaviour in this session. If you'd like to help\n"    \
Packit 16808d
 "resolve this issue, please copy and paste the following block into\n"  \
Packit 16808d
 "an email to the address listed below with a brief explanation of\n"    \
Packit 16808d
 "what you were doing at the time of this message. Thanks a lot!"
Packit 16808d
#endif
Packit 16808d
Packit 16808d
Packit 16808d
void mw_debug_datav(const guchar *buf, gsize len,
Packit 16808d
		    const char *info, va_list args);
Packit 16808d
Packit 16808d
Packit 16808d
void mw_debug_data(const guchar *buf, gsize len,
Packit 16808d
		   const char *info, ...);
Packit 16808d
Packit 16808d
Packit 16808d
void mw_debug_opaquev(struct mwOpaque *o, const char *info, va_list args);
Packit 16808d
Packit 16808d
Packit 16808d
void mw_debug_opaque(struct mwOpaque *o, const char *info, ...);
Packit 16808d
Packit 16808d
Packit 16808d
void mw_mailme_datav(const guchar *buf, gsize len,
Packit 16808d
		     const char *info, va_list args);
Packit 16808d
Packit 16808d
void mw_mailme_data(const guchar *buf, gsize len,
Packit 16808d
		    const char *info, ...);
Packit 16808d
Packit 16808d
Packit 16808d
/** Outputs a hex dump of a mwOpaque with debugging info and a
Packit 16808d
    pre-defined message. Identical to mw_mailme_opaque, but taking a
Packit 16808d
    va_list argument */
Packit 16808d
void mw_mailme_opaquev(struct mwOpaque *o, const char *info, va_list args);
Packit 16808d
Packit 16808d
Packit 16808d
Packit 16808d
/** Outputs a hex dump of a mwOpaque with debugging info and a
Packit 16808d
    pre-defined message.
Packit 16808d
Packit 16808d
    if MW_MAILME is undefined or false, this function acts the same as
Packit 16808d
    mw_mailme_opaque.
Packit 16808d
Packit 16808d
    @arg block  data to be printed in a hex block
Packit 16808d
    @arg info   a printf-style format string
Packit 16808d
Packit 16808d
    The resulting message is in the following format:
Packit 16808d
    @code
Packit 16808d
    MW_MAILME_MESSAGE
Packit 16808d
    " Please send mail to: " MW_MAILME_ADDRESS
Packit 16808d
    MW_MAILME_CUT_START
Packit 16808d
    info
Packit 16808d
    block
Packit 16808d
    MW_MAILME_CUT_STOP
Packit 16808d
    @endcode
Packit 16808d
 */
Packit 16808d
void mw_mailme_opaque(struct mwOpaque *o, const char *info, ...);
Packit 16808d
Packit 16808d
Packit 16808d
#endif
Packit 16808d