X-Git-Url: http://www.project-moonshot.org/gitweb/?a=blobdiff_plain;f=lib%2Fdebug.c;h=903c7931c492578be00411d846571481ce5c57b3;hb=fed9094cd8cda69605d0c103acd14308379b6eb0;hp=801f2fbdb0ef6108f0d3a41497cc2b950ca88046;hpb=81a1e7ed51a23f8e5d891684deb3b96b5419a63b;p=radsecproxy.git diff --git a/lib/debug.c b/lib/debug.c index 801f2fb..903c793 100644 --- a/lib/debug.c +++ b/lib/debug.c @@ -1,12 +1,14 @@ -/* See the file COPYING for licensing information. */ +/* Copyright 2011 NORDUnet A/S. All rights reserved. + See LICENSE for licensing information. */ #if defined HAVE_CONFIG_H #include #endif +#include #include #include -#include +#include #include #include #include "debug.h" @@ -14,17 +16,31 @@ void rs_dump_packet (const struct rs_packet *pkt) { - const RADIUS_PACKET *p = pkt->rpkt; - assert(p); + const RADIUS_PACKET *p = NULL; - fprintf (stderr, "\tCode: %u, Identifier: %u, Lenght: %u\n", + if (!pkt || !pkt->rpkt) + return; + p = pkt->rpkt; + + fprintf (stderr, "\tCode: %u, Identifier: %u, Lenght: %zu\n", p->code, p->id, - p->data_len); + p->sizeof_data); + fflush (stderr); } -void -rs_dump_attr (const struct rs_attr *attr) +#if defined DEBUG +int +_rs_debug (const char *fmt, ...) { - vp_printlist (stderr, attr->vp); + int n; + va_list args; + + va_start (args, fmt); + n = vfprintf (stderr, fmt, args); + va_end (args); + fflush (stderr); + + return n; } +#endif