* and address to string conversion routines
*/
+#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#define HASHNAMESIZE 4096
struct hnamemem {
- u_int32_t addr;
+ uint32_t addr;
const char *name;
struct hnamemem *nxt;
};
static struct enamemem bytestringtable[HASHNAMESIZE];
struct protoidmem {
- u_int32_t p_oui;
+ uint32_t p_oui;
u_short p_proto;
const char *p_name;
struct protoidmem *p_nxt;
* A faster replacement for inet_ntoa().
*/
const char *
-intoa(u_int32_t addr)
+intoa(uint32_t addr)
{
register char *cp;
register u_int byte;
return cp + 1;
}
-static u_int32_t f_netmask;
-static u_int32_t f_localnet;
+static uint32_t f_netmask;
+static uint32_t f_localnet;
/*
* Return a name for the IP address pointed to by ap. This address
getname(netdissect_options *ndo, const u_char *ap)
{
register struct hostent *hp;
- u_int32_t addr;
+ uint32_t addr;
static struct hnamemem *p; /* static for longjmp() */
memcpy(&addr, ap, sizeof(addr));
char *dotp;
p->name = strdup(hp->h_name);
- if (Nflag) {
+ if (ndo->ndo_Nflag) {
/* Remove domain qualifications */
dotp = strchr(p->name, '.');
if (dotp)
struct in6_addr addr;
struct for_hash_addr {
char fill[14];
- u_int16_t d;
+ uint16_t d;
} addra;
} addr;
static struct h6namemem *p; /* static for longjmp() */
char *dotp;
p->name = strdup(hp->h_name);
- if (Nflag) {
+ if (ndo->ndo_Nflag) {
/* Remove domain qualifications */
dotp = strchr(p->name, '.');
if (dotp)
{
register char *cp;
register struct hnamemem *tp;
- register u_int32_t i = port;
+ register uint32_t i = port;
char buf[sizeof("0000")];
for (tp = &eprototable[i & (HASHNAMESIZE-1)]; tp->nxt; tp = tp->nxt)
tcpport_string(u_short port)
{
register struct hnamemem *tp;
- register u_int32_t i = port;
+ register uint32_t i = port;
char buf[sizeof("00000")];
for (tp = &tporttable[i & (HASHNAMESIZE-1)]; tp->nxt; tp = tp->nxt)
udpport_string(register u_short port)
{
register struct hnamemem *tp;
- register u_int32_t i = port;
+ register uint32_t i = port;
char buf[sizeof("00000")];
for (tp = &uporttable[i & (HASHNAMESIZE-1)]; tp->nxt; tp = tp->nxt)
{
register char *cp;
register struct hnamemem *tp;
- register u_int32_t i = port;
+ register uint32_t i = port;
char buf[sizeof("0000")];
for (tp = &ipxsaptable[i & (HASHNAMESIZE-1)]; tp->nxt; tp = tp->nxt)
/* in libpcap.a (nametoaddr.c) */
#if defined(WIN32) && !defined(USE_STATIC_LIBPCAP)
-__declspec(dllimport)
+extern __declspec(dllimport)
#else
extern
#endif
/*
* Initialize the address to name translation machinery. We map all
- * non-local IP addresses to numeric addresses if fflag is true (i.e.,
- * to prevent blocking on the nameserver). localnet is the IP address
+ * non-local IP addresses to numeric addresses if ndo->ndo_fflag is true
+ * (i.e., to prevent blocking on the nameserver). localnet is the IP address
* of the local network. mask is its subnet mask.
*/
void
-init_addrtoname(netdissect_options *ndo, u_int32_t localnet, u_int32_t mask)
+init_addrtoname(netdissect_options *ndo, uint32_t localnet, uint32_t mask)
{
- if (fflag) {
+ if (ndo->ndo_fflag) {
f_localnet = localnet;
f_netmask = mask;
}