mirror of
https://github.com/the-tcpdump-group/tcpdump.git
synced 2024-11-24 10:33:28 +08:00
Get rid of unnecessary includes, and use tcpdump's "ip.h" and "udp.h"
rather than the OS's <netinet/ip.h> and <netinet/udp.h>. As per Bill Fenner's suggestion, print single-byte 2-digit hex values with "%02X" rather than manually pulling the nibbles out of the byte and converting them.
This commit is contained in:
parent
f4f269aecb
commit
46f6e51d59
@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
static const char rcsid[] =
|
static const char rcsid[] =
|
||||||
"$Id: print-radius.c,v 1.1 2000-10-06 06:49:21 guy Exp $";
|
"$Id: print-radius.c,v 1.2 2000-10-08 08:48:48 guy Exp $";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
@ -31,15 +31,8 @@ static const char rcsid[] =
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <sys/time.h>
|
|
||||||
#include <sys/socket.h>
|
|
||||||
|
|
||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
#include <netinet/in_systm.h>
|
|
||||||
#include <netinet/ip.h>
|
|
||||||
#include <netinet/ip_var.h>
|
|
||||||
#include <netinet/udp.h>
|
|
||||||
#include <netinet/udp_var.h>
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
@ -47,15 +40,15 @@ static const char rcsid[] =
|
|||||||
#include "addrtoname.h"
|
#include "addrtoname.h"
|
||||||
#include "extract.h"
|
#include "extract.h"
|
||||||
|
|
||||||
#define TAM_SIZE(x) (sizeof(x)/sizeof(x[0]) )
|
#include "ip.h"
|
||||||
|
#include "udp.h"
|
||||||
|
|
||||||
#define HEX(a) ((char)( (a) <= 9 ? (a) + '0' : ((a) - 10) + 'A'))
|
#define TAM_SIZE(x) (sizeof(x)/sizeof(x[0]) )
|
||||||
|
|
||||||
#define PRINT_HEX(bytes_len, ptr_data) \
|
#define PRINT_HEX(bytes_len, ptr_data) \
|
||||||
while(bytes_len) \
|
while(bytes_len) \
|
||||||
{ \
|
{ \
|
||||||
printf("%c%c", HEX( ((u_short)(*ptr_data)) >> 4 ), \
|
printf("%02X", *ptr_data ); \
|
||||||
HEX( ((u_short)(*ptr_data)) & 0x0F ) ); \
|
|
||||||
ptr_data++; \
|
ptr_data++; \
|
||||||
bytes_len--; \
|
bytes_len--; \
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user