Qt: Improve our capture filter completions.

Use libpcap's pcap-filter.manmisc to create our capture filter
completion list instead of scanner.l.

Bug: 14430
Change-Id: I11f6eb5679dc93561dce62f28149e103ac9b4a2b
Reviewed-on: https://code.wireshark.org/review/25971
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
This commit is contained in:
Gerald Combs 2018-02-21 10:56:05 -08:00 committed by Anders Broman
parent 5d45b69b59
commit 205424287b
1 changed files with 69 additions and 18 deletions

View File

@ -40,25 +40,76 @@
static const QString libpcap_primitive_chars_ = "-0123456789abcdefghijklmnopqrstuvwxyz";
// grep '^[a-z].*return [A-Z].*;$' scanner.l | awk '{gsub(/\|/, "\n") ; print " << \"" $1 "\""}' | sort
// Remove "and" and "or".
// Primitives are from pcap-filter.manmisc
static const QStringList libpcap_primitives_ = QStringList()
<< "aarp" << "action" << "address1" << "address2" << "address3" << "address4"
<< "ah" << "arp" << "atalk" << "bcc" << "broadcast" << "byte" << "carp"
<< "clnp" << "connectmsg" << "csnp" << "decnet" << "direction" << "dpc"
<< "dst" << "es-is" << "esis" << "esp" << "fddi" << "fisu" << "gateway"
<< "greater" << "hdpc" << "hfisu" << "hlssu" << "hmsu" << "hopc" << "host"
<< "hsio" << "hsls" << "icmp" << "icmp6" << "igmp" << "igrp" << "iih" << "ilmic"
<< "inbound" << "ip" << "ip6" << "ipx" << "is-is" << "isis" << "iso" << "l1"
<< "l2" << "lane" << "lat" << "len" << "less" << "link" << "llc" << "lsp"
<< "lssu" << "lsu" << "mask" << "metac" << "metaconnect" << "mopdl" << "moprc"
<< "mpls" << "msu" << "multicast" << "net" << "netbeui" << "oam" << "oamf4"
<< "oamf4ec" << "oamf4sc" << "on" << "opc" << "outbound" << "pim"
<< "port" << "portrange" << "pppoed" << "pppoes" << "proto" << "psnp" << "ra"
<< "radio" << "rarp" << "reason" << "rnr" << "rset" << "sc" << "sca" << "sctp"
<< "sio" << "sls" << "snp" << "src" << "srnr" << "stp" << "subtype" << "ta"
<< "tcp" << "type" << "udp" << "vci" << "vlan" << "vpi" << "vrrp"
;
// "Abbreviations for..."
<< "ether proto"
<< "ip" << "ip6" << "arp" << "rarp" << "atalk" << "aarp" << "decnet" << "iso" << "stp" << "ipx" << "netbeui"
<< "moprc" << "mopdl"
// ip proto
<< "tcp" << "udp" << "icmp"
// iso proto
<< "clnp" << "esis" << "isis"
// ISIS PDU types
<< "l1" << "l2" << "iih" << "lsp" << "snp" << "csnp" << "psnp"
// grep -E '^\.IP "\\fB.*\\f(R"|P)$' pcap-filter.manmisc | sed -e 's/^\.IP "\\fB/<< "/' -e 's/ *\\f.*/"/' | sort -u
<< "action"
<< "clnp"
<< "decnet dst"
<< "decnet host"
<< "decnet src"
<< "dir"
<< "dst host"
<< "dst net"
<< "dst port"
<< "dst portrange"
<< "ether broadcast"
<< "ether dst"
<< "ether host"
<< "ether multicast"
<< "ether src"
<< "gateway"
<< "greater"
<< "host"
<< "ifname"
<< "ip broadcast"
<< "ip multicast"
<< "ip proto"
<< "ip protochain"
<< "ip6 multicast"
<< "ip6 proto"
<< "ip6 protochain"
<< "iso proto"
<< "l1"
<< "lat"
<< "less"
<< "mpls"
<< "net"
<< "on"
<< "port"
<< "portrange"
<< "reason"
<< "rnr"
<< "rset"
<< "rulenum"
<< "ruleset"
<< "src host"
<< "src net"
<< "src port"
<< "src portrange"
<< "srnr"
<< "subrulenum"
<< "subtype"
<< "type"
<< "vlan"
<< "wlan addr1"
<< "wlan addr2"
<< "wlan addr3"
<< "wlan addr4"
<< "wlan ra"
<< "wlan ta"
;
CaptureFilterEdit::CaptureFilterEdit(QWidget *parent, bool plain) :
SyntaxLineEdit(parent),