Enable tls psk
[radsecproxy.git] / debug.c
1 /* Copyright 2011 NORDUnet A/S. All rights reserved.
2    See LICENSE for licensing information. */
3
4 #if defined HAVE_CONFIG_H
5 #include <config.h>
6 #endif
7
8 #include <sys/types.h>
9 #include <stdio.h>
10 #include <assert.h>
11 #include <radius/client.h>
12 #include <radsec/radsec.h>
13 #include <radsec/radsec-impl.h>
14 #include "debug.h"
15
16 void
17 rs_dump_packet (const struct rs_packet *pkt)
18 {
19   const RADIUS_PACKET *p = NULL;
20
21   if (!pkt || !pkt->rpkt)
22     return;
23   p = pkt->rpkt;
24
25   fprintf (stderr, "\tCode: %u, Identifier: %u, Lenght: %zu\n",
26            p->code,
27            p->id,
28            p->sizeof_data);
29   fflush (stderr);
30 }
31
32 #if defined DEBUG
33 int
34 _rs_debug (const char *fmt, ...)
35 {
36   int n;
37   va_list args;
38
39   va_start (args, fmt);
40   n = vfprintf (stderr, fmt, args);
41   va_end (args);
42   fflush (stderr);
43
44   return n;
45 }
46 #endif