summaryrefslogtreecommitdiff
path: root/lib/debug.c
blob: 4d308461fe2c786e28b9ea54b3b0cbbb550329d0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/* Copyright 2011 NORDUnet A/S. All rights reserved.
   See LICENSE for licensing information.  */

#if defined HAVE_CONFIG_H
#include <config.h>
#endif

#include <sys/types.h>
#include <stdio.h>
#include <assert.h>
#include <radius/client.h>
#include <radsec/radsec.h>
#include <radsec/radsec-impl.h>
#include "debug.h"

void
rs_dump_message (const struct rs_message *msg)
{
  const RADIUS_PACKET *p = NULL;

  if (!msg || !msg->rpkt)
    return;
  p = msg->rpkt;

  fprintf (stderr, "\tCode: %u, Identifier: %u, Lenght: %zu\n",
	   p->code,
	   p->id,
	   p->sizeof_data);
  fflush (stderr);
}

#if defined DEBUG
int
_rs_debug (const char *fmt, ...)
{
  int n;
  va_list args;

  va_start (args, fmt);
  n = vfprintf (stderr, fmt, args);
  va_end (args);
  fflush (stderr);

  return n;
}
#endif