Blame src/mw_debug.h

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