X-Git-Url: http://www.project-moonshot.org/gitweb/?p=radsecproxy.git;a=blobdiff_plain;f=debug.h;h=ed62da140aa52c29e76b9ad6337fad4531cbde96;hp=803f406b397370af6fdb357b26d4b3df052f6b4d;hb=HEAD;hpb=7ddd8bca678fdd91faa01966d40b3778d085126e diff --git a/debug.h b/debug.h index 803f406..ed62da1 100644 --- a/debug.h +++ b/debug.h @@ -1,32 +1,27 @@ -/* - * Copyright (C) 2007 Stig Venaas - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - */ +/* Copyright 2011 NORDUnet A/S. All rights reserved. + See LICENSE for licensing information. */ -#ifndef SYS_SOLARIS9 -#include +#define hd(p, l) { int i; \ + for (i = 1; i <= l; i++) { \ + printf ("%02x ", p[i-1]); \ + if (i % 8 == 0) printf (" "); \ + if (i % 16 == 0) printf ("\n"); } \ + printf ("\n"); } + +#if defined (__cplusplus) +extern "C" { #endif -#define DBG_DBG 8 -#define DBG_INFO 16 -#define DBG_NOTICE 32 -#define DBG_WARN 64 -#define DBG_ERR 128 +struct rs_packet; +void rs_dump_packet (const struct rs_packet *pkt); +int _rs_debug (const char *fmt, ...); -void debug_init(char *ident); -void debug_set_level(uint8_t level); -void debug_timestamp_on(); -uint8_t debug_get_level(); -void debug(uint8_t level, char *format, ...); -void debugx(int status, uint8_t level, char *format, ...); -void debugerrno(int err, uint8_t level, char *format, ...); -void debugerrnox(int err, uint8_t level, char *format, ...); -int debug_set_destination(char *dest); -void debug_reopen_log(); +#if defined (DEBUG) +#define rs_debug(x) _rs_debug x +#else +#define rs_debug(x) do {;} while (0) +#endif -/* Local Variables: */ -/* c-file-style: "stroustrup" */ -/* End: */ +#if defined (__cplusplus) +} +#endif