tcpdump
4.99.1
About: tcpdump is a tool for network monitoring and data acquisition.
![]() ![]() |
#include "netdissect-stdinc.h"
#include <pcap.h>
#include <pcap-namedb.h>
#include <getservent.h>
#include <signal.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "netdissect.h"
#include "addrtoname.h"
#include "addrtostr.h"
#include "ethertype.h"
#include "llc.h"
#include "extract.h"
#include "oui.h"
Go to the source code of this file.
Data Structures | |
struct | hnamemem |
struct | h6namemem |
struct | enamemem |
struct | bsnamemem |
struct | protoidmem |
struct | eproto |
struct | protoidlist |
struct | etherlist |
struct | ipxsap_ent |
Macros | |
#define | HASHNAMESIZE 4096 |
#define | ISONSAP_MAX_LENGTH 20 |
Functions | |
const char * | intoa (uint32_t addr) |
const char * | ipaddr_string (netdissect_options *ndo, const u_char *ap) |
const char * | ip6addr_string (netdissect_options *ndo, const u_char *ap) |
static char * | octet_to_hex (char *cp, uint8_t octet) |
static struct enamemem * | lookup_emem (netdissect_options *ndo, const u_char *ep) |
static struct bsnamemem * | lookup_bytestring (netdissect_options *ndo, const u_char *bs, const unsigned int nlen) |
static struct enamemem * | lookup_nsap (netdissect_options *ndo, const u_char *nsap, u_int nsap_length) |
static struct protoidmem * | lookup_protoid (netdissect_options *ndo, const u_char *pi) |
const char * | etheraddr_string (netdissect_options *ndo, const uint8_t *ep) |
const char * | le64addr_string (netdissect_options *ndo, const uint8_t *ep) |
const char * | linkaddr_string (netdissect_options *ndo, const uint8_t *ep, const unsigned int type, const unsigned int len) |
const char * | isonsap_string (netdissect_options *ndo, const uint8_t *nsap, u_int nsap_length) |
const char * | tcpport_string (netdissect_options *ndo, u_short port) |
const char * | udpport_string (netdissect_options *ndo, u_short port) |
const char * | ipxsap_string (netdissect_options *ndo, u_short port) |
static void | init_servarray (netdissect_options *ndo) |
static void | init_eprotoarray (netdissect_options *ndo) |
static void | init_protoidarray (netdissect_options *ndo) |
static void | init_etherarray (netdissect_options *ndo) |
static void | init_ipxsaparray (netdissect_options *ndo) |
void | init_addrtoname (netdissect_options *ndo, uint32_t localnet, uint32_t mask) |
const char * | dnaddr_string (netdissect_options *ndo, u_short dnaddr) |
struct hnamemem * | newhnamemem (netdissect_options *ndo) |
struct h6namemem * | newh6namemem (netdissect_options *ndo) |
const char * | ieee8021q_tci_string (const uint16_t tci) |
Variables | |
static struct hnamemem | hnametable [4096] |
static struct hnamemem | tporttable [4096] |
static struct hnamemem | uporttable [4096] |
static struct hnamemem | eprototable [4096] |
static struct hnamemem | dnaddrtable [4096] |
static struct hnamemem | ipxsaptable [4096] |
static struct h6namemem | h6nametable [4096] |
static struct enamemem | enametable [4096] |
static struct enamemem | nsaptable [4096] |
static struct bsnamemem | bytestringtable [4096] |
static struct protoidmem | protoidtable [4096] |
static uint32_t | f_netmask |
static uint32_t | f_localnet |
static const char | hex [16] |
static const struct eproto | eproto_db [] |
static const struct protoidlist | protoidlist [] |
static const struct etherlist | etherlist [] |
static const struct ipxsap_ent | ipxsap_db [] |
#define HASHNAMESIZE 4096 |
Definition at line 125 of file addrtoname.c.
#define ISONSAP_MAX_LENGTH 20 |
Definition at line 706 of file addrtoname.c.
const char* dnaddr_string | ( | netdissect_options * | ndo, |
u_short | dnaddr | ||
) |
Definition at line 1267 of file addrtoname.c.
References hnamemem::addr, dnaddrtable, dnnum_string(), HASHNAMESIZE, hnamemem::name, newhnamemem(), and hnamemem::nxt.
Referenced by decnet_print(), and print_decnet_ctlmsg().
const char* etheraddr_string | ( | netdissect_options * | ndo, |
const uint8_t * | ep | ||
) |
Definition at line 591 of file addrtoname.c.
References BUFSIZE, enamemem::e_name, ether_ntohost(), EXTRACT_BE_U_3, lookup_emem(), MAC_ADDR_LEN, netdissect_options::ndo_error, netdissect_options::ndo_nflag, octet_to_hex(), oui_values, S_ERR_ND_MEM_ALLOC, snprintf(), strdup(), and tok2str().
Referenced by ether_common_print(), fddi_hdr_print(), fddi_print(), get_etheraddr_string(), handle_reassoc_request(), ieee802_11_print(), ipfc_hdr_print(), ipfc_print(), linkaddr_string(), lldp_network_addr_print(), token_hdr_print(), and token_print().
const char* ieee8021q_tci_string | ( | const uint16_t | tci | ) |
Definition at line 1325 of file addrtoname.c.
References snprintf().
Referenced by ether_common_print(), of10_bsn_actions_print(), sll2_if_print(), and sll_if_print().
void init_addrtoname | ( | netdissect_options * | ndo, |
uint32_t | localnet, | ||
uint32_t | mask | ||
) |
Definition at line 1247 of file addrtoname.c.
References f_localnet, f_netmask, init_eprotoarray(), init_etherarray(), init_ipxsaparray(), init_protoidarray(), init_servarray(), netdissect_options::ndo_fflag, and netdissect_options::ndo_nflag.
Referenced by init_print().
|
static |
Definition at line 866 of file addrtoname.c.
References hnamemem::addr, eproto_db, eprototable, HASHNAMESIZE, hnamemem::name, newhnamemem(), hnamemem::nxt, and eproto::s.
Referenced by init_addrtoname().
|
static |
Definition at line 953 of file addrtoname.c.
References etherlist::addr, enamemem::e_name, ether_ntohost(), lookup_emem(), MAC_ADDR_LEN, etherlist::name, name, netdissect_options::ndo_error, S_ERR_ND_MEM_ALLOC, and strdup().
Referenced by init_addrtoname().
|
static |
Definition at line 1224 of file addrtoname.c.
References hnamemem::addr, HASHNAMESIZE, ipxsap_db, ipxsaptable, hnamemem::name, newhnamemem(), hnamemem::nxt, and ipxsap_ent::s.
Referenced by init_addrtoname().
|
static |
Definition at line 899 of file addrtoname.c.
References eproto_db, lookup_protoid(), protoidlist::name, netdissect_options::ndo_error, protoidmem::p_name, protoidlist::protoid, eproto::s, S_ERR_ND_MEM_ALLOC, and strdup().
Referenced by init_addrtoname().
|
static |
Definition at line 812 of file addrtoname.c.
References hnamemem::addr, endservent(), getservent(), HASHNAMESIZE, hnamemem::name, netdissect_options::ndo_error, netdissect_options::ndo_nflag, newhnamemem(), hnamemem::nxt, S_ERR_ND_MEM_ALLOC, snprintf(), strdup(), tporttable, and uporttable.
Referenced by init_addrtoname().
const char* intoa | ( | uint32_t | addr | ) |
Definition at line 225 of file addrtoname.c.
Referenced by cnfp_v1_print(), cnfp_v5_print(), cnfp_v6_print(), ipaddr_string(), ns_rprint(), print_report(), and vldb_reply_print().
const char* ip6addr_string | ( | netdissect_options * | ndo, |
const u_char * | ap | ||
) |
Definition at line 338 of file addrtoname.c.
References h6namemem::addr, addrtostr6(), AF_INET6, h6nametable, HASHNAMESIZE, INET6_ADDRSTRLEN, h6namemem::name, netdissect_options::ndo_error, netdissect_options::ndo_nflag, netdissect_options::ndo_Nflag, newh6namemem(), h6namemem::nxt, S_ERR_ND_MEM_ALLOC, and strdup().
Referenced by decode_labeled_prefix6(), decode_labeled_vpn_prefix6(), decode_prefix6(), format_address(), format_prefix(), get_ip6addr_string(), icmp6_opt_print(), isis_print_extd_ip_reach(), lldp_network_addr_print(), ospf6_print_lsaprefix(), print_attr_netmask6(), rpl_dao_print(), rpl_daoack_print(), and rpl_dio_print().
const char* ipaddr_string | ( | netdissect_options * | ndo, |
const u_char * | ap | ||
) |
Definition at line 279 of file addrtoname.c.
References hnamemem::addr, f_localnet, f_netmask, HASHNAMESIZE, hnametable, intoa(), hnamemem::name, netdissect_options::ndo_error, netdissect_options::ndo_nflag, netdissect_options::ndo_Nflag, newhnamemem(), hnamemem::nxt, S_ERR_ND_MEM_ALLOC, and strdup().
Referenced by decode_labeled_prefix4(), decode_labeled_vpn_prefix4(), decode_prefix4(), egpnr_print(), eigrp_print(), format_address(), format_prefix(), get_ipaddr_string(), isis_print_extd_ip_reach(), lldp_network_addr_print(), and print_prefix().
const char* ipxsap_string | ( | netdissect_options * | ndo, |
u_short | port | ||
) |
Definition at line 783 of file addrtoname.c.
References hnamemem::addr, HASHNAMESIZE, hex, ipxsaptable, hnamemem::name, netdissect_options::ndo_error, newhnamemem(), hnamemem::nxt, S_ERR_ND_MEM_ALLOC, and strdup().
Referenced by ipx_sap_print().
const char* isonsap_string | ( | netdissect_options * | ndo, |
const uint8_t * | nsap, | ||
u_int | nsap_length | ||
) |
Definition at line 708 of file addrtoname.c.
References enamemem::e_name, ISONSAP_MAX_LENGTH, lookup_nsap(), netdissect_options::ndo_error, octet_to_hex(), and S_ERR_ND_MEM_ALLOC.
Referenced by decode_clnp_prefix(), decode_labeled_vpn_clnp_prefix(), and get_isonsap_string().
const char* le64addr_string | ( | netdissect_options * | ndo, |
const uint8_t * | ep | ||
) |
Definition at line 643 of file addrtoname.c.
References bsnamemem::bs_name, BUFSIZE, lookup_bytestring(), netdissect_options::ndo_error, octet_to_hex(), S_ERR_ND_MEM_ALLOC, and strdup().
Referenced by get_le64addr_string().
const char* linkaddr_string | ( | netdissect_options * | ndo, |
const uint8_t * | ep, | ||
const unsigned int | type, | ||
const unsigned int | len | ||
) |
Definition at line 673 of file addrtoname.c.
References bsnamemem::bs_name, etheraddr_string(), LINKADDR_ETHER, LINKADDR_FRELAY, lookup_bytestring(), MAC_ADDR_LEN, netdissect_options::ndo_error, octet_to_hex(), q922_string(), and S_ERR_ND_MEM_ALLOC.
Referenced by get_linkaddr_string().
|
static |
Definition at line 470 of file addrtoname.c.
References bsnamemem::bs_addr0, bsnamemem::bs_addr1, bsnamemem::bs_addr2, bsnamemem::bs_bytes, bsnamemem::bs_nbytes, bsnamemem::bs_nxt, bytestringtable, HASHNAMESIZE, netdissect_options::ndo_error, and S_ERR_ND_MEM_ALLOC.
Referenced by le64addr_string(), and linkaddr_string().
|
static |
Definition at line 437 of file addrtoname.c.
References enamemem::e_addr0, enamemem::e_addr1, enamemem::e_addr2, enamemem::e_nxt, enametable, HASHNAMESIZE, netdissect_options::ndo_error, and S_ERR_ND_MEM_ALLOC.
Referenced by etheraddr_string(), and init_etherarray().
|
static |
Definition at line 520 of file addrtoname.c.
References enamemem::e_addr0, enamemem::e_addr1, enamemem::e_addr2, enamemem::e_nsap, enamemem::e_nxt, HASHNAMESIZE, netdissect_options::ndo_error, nsaptable, and S_ERR_ND_MEM_ALLOC.
Referenced by isonsap_string().
|
static |
Definition at line 565 of file addrtoname.c.
References HASHNAMESIZE, netdissect_options::ndo_error, protoidmem::p_nxt, protoidmem::p_oui, protoidmem::p_proto, protoidtable, and S_ERR_ND_MEM_ALLOC.
Referenced by init_protoidarray().
struct h6namemem* newh6namemem | ( | netdissect_options * | ndo | ) |
Definition at line 1305 of file addrtoname.c.
References netdissect_options::ndo_error, and S_ERR_ND_MEM_ALLOC.
Referenced by ip6addr_string().
struct hnamemem* newhnamemem | ( | netdissect_options * | ndo | ) |
Definition at line 1285 of file addrtoname.c.
References netdissect_options::ndo_error, and S_ERR_ND_MEM_ALLOC.
Referenced by ataddr_string(), dnaddr_string(), init_eprotoarray(), init_ipxsaparray(), init_servarray(), ipaddr_string(), ipxsap_string(), tcpport_string(), and udpport_string().
|
inlinestatic |
Definition at line 427 of file addrtoname.c.
References hex.
Referenced by etheraddr_string(), isonsap_string(), le64addr_string(), and linkaddr_string().
const char* tcpport_string | ( | netdissect_options * | ndo, |
u_short | port | ||
) |
Definition at line 739 of file addrtoname.c.
References hnamemem::addr, HASHNAMESIZE, hnamemem::name, netdissect_options::ndo_error, newhnamemem(), hnamemem::nxt, S_ERR_ND_MEM_ALLOC, snprintf(), strdup(), and tporttable.
Referenced by icmp6_print(), icmp_print(), pgm_print(), and tcp_print().
const char* udpport_string | ( | netdissect_options * | ndo, |
u_short | port | ||
) |
Definition at line 761 of file addrtoname.c.
References hnamemem::addr, HASHNAMESIZE, hnamemem::name, netdissect_options::ndo_error, newhnamemem(), hnamemem::nxt, S_ERR_ND_MEM_ALLOC, snprintf(), strdup(), and uporttable.
Referenced by icmp6_print(), icmp_print(), and udpipaddr_print().
|
static |
Definition at line 1 of file addrtoname.c.
Referenced by lookup_bytestring().
|
static |
Definition at line 1 of file addrtoname.c.
Referenced by dnaddr_string().
|
static |
Definition at line 1 of file addrtoname.c.
Referenced by lookup_emem().
|
static |
Referenced by init_eprotoarray(), and init_protoidarray().
|
static |
Definition at line 1 of file addrtoname.c.
Referenced by init_eprotoarray().
|
static |
Definition at line 255 of file addrtoname.c.
Referenced by init_addrtoname(), and ipaddr_string().
|
static |
Definition at line 254 of file addrtoname.c.
Referenced by init_addrtoname(), and ipaddr_string().
|
static |
Definition at line 1 of file addrtoname.c.
Referenced by ip6addr_string().
|
static |
Definition at line 397 of file addrtoname.c.
Referenced by ipxsap_string(), octet_to_hex(), and print_field().
|
static |
Definition at line 1 of file addrtoname.c.
Referenced by ipaddr_string().
|
static |
Referenced by init_ipxsaparray().
|
static |
Definition at line 1 of file addrtoname.c.
Referenced by init_ipxsaparray(), and ipxsap_string().
|
static |
Definition at line 1 of file addrtoname.c.
Referenced by lookup_nsap().
|
static |
|
static |
Definition at line 1 of file addrtoname.c.
Referenced by lookup_protoid().
|
static |
Definition at line 1 of file addrtoname.c.
Referenced by init_servarray(), and tcpport_string().
|
static |
Definition at line 1 of file addrtoname.c.
Referenced by init_servarray(), and udpport_string().