Changeset View
Changeset View
Standalone View
Standalone View
head/contrib/tcpdump/print-decnet.c
Show First 20 Lines • Show All 265 Lines • ▼ Show 20 Lines | union controlmsg | ||||
struct l2rout cm_l2rout; /* level 2 routing message */ | struct l2rout cm_l2rout; /* level 2 routing message */ | ||||
struct rhellomsg cm_rhello; /* router hello message */ | struct rhellomsg cm_rhello; /* router hello message */ | ||||
struct ehellomsg cm_ehello; /* endnode hello message */ | struct ehellomsg cm_ehello; /* endnode hello message */ | ||||
}; | }; | ||||
/* Macros for decoding routing-info fields */ | /* Macros for decoding routing-info fields */ | ||||
#define RI_COST(x) ((x)&0777) | #define RI_COST(x) ((x)&0777) | ||||
#define RI_HOPS(x) (((x)>>10)&037) | #define RI_HOPS(x) (((x)>>10)&037) | ||||
␌ | |||||
/* | /* | ||||
* NSP protocol fields and values. | * NSP protocol fields and values. | ||||
*/ | */ | ||||
#define NSP_TYPEMASK 014 /* mask to isolate type code */ | #define NSP_TYPEMASK 014 /* mask to isolate type code */ | ||||
#define NSP_SUBMASK 0160 /* mask to isolate subtype code */ | #define NSP_SUBMASK 0160 /* mask to isolate subtype code */ | ||||
#define NSP_SUBSHFT 4 /* shift to move subtype code */ | #define NSP_SUBSHFT 4 /* shift to move subtype code */ | ||||
▲ Show 20 Lines • Show All 1,027 Lines • ▼ Show 20 Lines | dnnum_string(u_short dnaddr) | ||||
return(str); | return(str); | ||||
} | } | ||||
const char * | const char * | ||||
dnname_string(u_short dnaddr) | dnname_string(u_short dnaddr) | ||||
{ | { | ||||
#ifdef HAVE_DNET_HTOA | #ifdef HAVE_DNET_HTOA | ||||
struct dn_naddr dna; | struct dn_naddr dna; | ||||
char *dnname; | |||||
dna.a_len = sizeof(short); | dna.a_len = sizeof(short); | ||||
memcpy((char *)dna.a_addr, (char *)&dnaddr, sizeof(short)); | memcpy((char *)dna.a_addr, (char *)&dnaddr, sizeof(short)); | ||||
return (strdup(dnet_htoa(&dna))); | dnname = dnet_htoa(&dna); | ||||
if(dnname != NULL) | |||||
return (strdup(dnname)); | |||||
else | |||||
return(dnnum_string(dnaddr)); | |||||
#else | #else | ||||
return(dnnum_string(dnaddr)); /* punt */ | return(dnnum_string(dnaddr)); /* punt */ | ||||
#endif | #endif | ||||
} | } | ||||
#ifdef PRINT_NSPDATA | #ifdef PRINT_NSPDATA | ||||
static void | static void | ||||
pdata(netdissect_options *ndo, | pdata(netdissect_options *ndo, | ||||
Show All 11 Lines |