diff options
author | Michael Mann <mmann78@netscape.net> | 2015-12-14 08:48:59 -0500 |
---|---|---|
committer | Michael Mann <mmann78@netscape.net> | 2015-12-14 22:35:15 +0000 |
commit | d835b271679c5e5eae7146b96ae1a65cbd5c16b4 (patch) | |
tree | 68bd42732c1b6ee509f9ae69bdaf8a6513c16f1d /epan/dissectors/packet-ip.c | |
parent | 54413c8594ab6fb8518ad9347f21d58038fceed9 (diff) |
Create some more capture dissector tables.
These were created from capture dissector functions that had switch statements determine "next" protocol/dissector. The registration decreases the need for function declarations in header files.
Added new capture dissection tables for IP, IPv6, TCP and UDP as that seems like the next logical place to expand
Change-Id: I1ec0cd54eecda4f400669ee5b026bf6e2b46545a
Reviewed-on: https://code.wireshark.org/review/12634
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'epan/dissectors/packet-ip.c')
-rw-r--r-- | epan/dissectors/packet-ip.c | 36 |
1 files changed, 6 insertions, 30 deletions
diff --git a/epan/dissectors/packet-ip.c b/epan/dissectors/packet-ip.c index 77debead48..31e8b0a410 100644 --- a/epan/dissectors/packet-ip.c +++ b/epan/dissectors/packet-ip.c @@ -572,36 +572,7 @@ capture_ip(const guchar *pd, int offset, int len, packet_counts *ld, const union if (!BYTES_ARE_IN_FRAME(offset, len, IPH_MIN_LEN)) return FALSE; - switch (pd[offset + 9]) { - case IP_PROTO_TCP: - ld->tcp++; - break; - case IP_PROTO_UDP: - case IP_PROTO_UDPLITE: - ld->udp++; - break; - case IP_PROTO_ICMP: - case IP_PROTO_ICMPV6: /* XXX - separate counters? */ - ld->icmp++; - break; - case IP_PROTO_SCTP: - ld->sctp++; - break; - case IP_PROTO_OSPF: - ld->ospf++; - break; - case IP_PROTO_GRE: - ld->gre++; - break; - case IP_PROTO_VINES: - ld->vines++; - break; - default: - ld->other++; - } - - /* We're incrementing "other", so consider this our packet */ - return TRUE; + return try_capture_dissector("ip.proto", pd[offset + 9], pd, offset+IPH_MIN_LEN, len, ld, pseudo_header); } #ifdef HAVE_GEOIP @@ -3135,6 +3106,7 @@ proto_register_ip(void) ip_dissector_table = register_dissector_table("ip.proto", "IP protocol", FT_UINT8, BASE_DEC, DISSECTOR_TABLE_NOT_ALLOW_DUPLICATE); heur_subdissector_list = register_heur_dissector_list("ip"); + register_capture_dissector_table("ip.proto", "IP protocol"); /* Register configuration options */ ip_module = prefs_register_protocol(proto_ip, NULL); @@ -3216,9 +3188,13 @@ proto_reg_handoff_ip(void) dissector_add_for_decode_as("udp.port", ip_handle); dissector_add_for_decode_as("pcli.payload", ip_handle); dissector_add_uint("wtap_encap", WTAP_ENCAP_RAW_IP4, ip_handle); + dissector_add_uint("enc", BSD_AF_INET, ip_handle); heur_dissector_add("tipc", dissect_ip_heur, "IP over TIPC", "ip_tipc", proto_ip, HEURISTIC_ENABLE); register_capture_dissector("ethertype", ETHERTYPE_IP, capture_ip, proto_ip); + register_capture_dissector("ax25.pid", AX25_P_IP, capture_ip, proto_ip); + register_capture_dissector("enc", BSD_AF_INET, capture_ip, proto_ip); + register_capture_dissector("ppp_hdlc", PPP_IP, capture_ip, proto_ip); } /* |